Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: achievement integration tests #956

Merged
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .env.integration-tests
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ ZOOM_MEETING_SDK_CLIENT_SECRET="ZOOM_MEETING_SDK_CLIENT_SECRET"
ZOOM_MEETING_SDK_CLIENT_ID="ZOOM_MEETING_SDK_CLIENT_ID"
ZOOM_API_KEY="ZOOM_API_KEY"
ZOOM_API_SECRET="ZOOM_API_SECRET"
ZOOM_ACCOUNT_ID="ZOOM_ACCOUNT_ID"
ZOOM_ACCOUNT_ID="ZOOM_ACCOUNT_ID"

GAMIFICATION_ACTIVE=true
4 changes: 3 additions & 1 deletion .env.integration-tests.debug
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ ZOOM_MEETING_SDK_CLIENT_SECRET="ZOOM_MEETING_SDK_CLIENT_SECRET"
ZOOM_MEETING_SDK_CLIENT_ID="ZOOM_MEETING_SDK_CLIENT_ID"
ZOOM_API_KEY="ZOOM_API_KEY"
ZOOM_API_SECRET="ZOOM_API_SECRET"
ZOOM_ACCOUNT_ID="ZOOM_ACCOUNT_ID"
ZOOM_ACCOUNT_ID="ZOOM_ACCOUNT_ID"

GAMIFICATION_ACTIVE=true
4 changes: 4 additions & 0 deletions common/achievement/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ export enum TemplateSelectEnum {
// string == metricId, group
const achievementTemplates: Map<TemplateSelectEnum, Map<string, Achievement_template[]>> = new Map();

export function purgeAchievementTemplates() {
LucasFalkowsky marked this conversation as resolved.
Show resolved Hide resolved
achievementTemplates.clear();
}

async function getAchievementTemplates(select: TemplateSelectEnum): Promise<Map<string, Achievement_template[]>> {
if (!achievementTemplates.has(select)) {
achievementTemplates.set(select, new Map());
Expand Down
11 changes: 5 additions & 6 deletions common/achievement/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,11 @@ export async function getBucketContext(userID: string, relation?: string): Promi

let subcourses = [];
if (!relationType || relationType === 'subcourse') {
let subcourseWhere = whereClause;
if (userType === 'student') {
subcourseWhere = { ...subcourseWhere, subcourse_instructors_student: { some: { studentId: id } } };
} else {
subcourseWhere = { ...subcourseWhere, subcourse_participants_pupil: { some: { pupilId: id } } };
}
const userClause =
userType === 'student'
? { subcourse_instructors_student: { some: { studentId: id } } }
: { subcourse_participants_pupil: { some: { pupilId: id } } };
const subcourseWhere = { ...whereClause, ...userClause };
subcourses = await prisma.subcourse.findMany({
where: subcourseWhere,
select: {
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/02_screening.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { test } from './base';
import { adminClient, createUserClient } from './base/clients';
import { instructorOne, instructorTwo, pupilOne, studentOne } from './01_user';

const screenerOne = test('Admin can create Screener Account', async () => {
export const screenerOne = test('Admin can create Screener Account', async () => {
const email = `test+${randomBytes(10).toString('base64')}@lern-fair.de`;
const firstname = randomBytes(10).toString('base64');
const lastname = randomBytes(10).toString('base64');
Expand Down
Loading
Loading