Merge remote-tracking branch 'origin/refactor/common' into feat/user-routes-test-interface-refactor

# Conflicts:
#	backend/src/controllers/students.ts
#	backend/src/controllers/teachers.ts
#	backend/src/interfaces/answer.ts
#	backend/src/interfaces/question.ts
#	backend/src/interfaces/student.ts
#	backend/src/services/classes.ts
#	backend/src/services/questions.ts
#	backend/src/services/students.ts
#	backend/src/services/teachers.ts
This commit is contained in:
Gabriellvl 2025-04-02 10:16:10 +02:00
commit 4ca568e738
57 changed files with 270 additions and 190 deletions

View file

@ -5,11 +5,11 @@ import example from '../../test-assets/learning-objects/pn-werkingnotebooks/pn-w
import { LearningObject } from '../../../src/entities/content/learning-object.entity';
import databaseLearningObjectProvider from '../../../src/services/learning-objects/database-learning-object-provider';
import { expectToBeCorrectFilteredLearningObject } from '../../test-utils/expectations';
import { FilteredLearningObject } from '../../../src/interfaces/learning-content';
import { Language } from '../../../src/entities/content/language';
import learningObjectExample from '../../test-assets/learning-objects/pn-werkingnotebooks/pn-werkingnotebooks-example';
import learningPathExample from '../../test-assets/learning-paths/pn-werking-example';
import { LearningPath } from '../../../src/entities/content/learning-path.entity';
import { FilteredLearningObject } from 'dwengo-1-common/src/interfaces/learning-content';
async function initExampleData(): Promise<{ learningObject: LearningObject; learningPath: LearningPath }> {
const learningObjectRepo = getLearningObjectRepository();

View file

@ -4,11 +4,11 @@ import { LearningObject } from '../../../src/entities/content/learning-object.en
import { getLearningObjectRepository, getLearningPathRepository } from '../../../src/data/repositories';
import learningObjectExample from '../../test-assets/learning-objects/pn-werkingnotebooks/pn-werkingnotebooks-example';
import learningObjectService from '../../../src/services/learning-objects/learning-object-service';
import { LearningObjectIdentifier, LearningPathIdentifier } from '../../../src/interfaces/learning-content';
import { Language } from '../../../src/entities/content/language';
import { envVars, getEnvVar } from '../../../src/util/envVars';
import { LearningPath } from '../../../src/entities/content/learning-path.entity';
import learningPathExample from '../../test-assets/learning-paths/pn-werking-example';
import { LearningObjectIdentifier, LearningPathIdentifier } from 'dwengo-1-common/src/interfaces/learning-content';
const EXPECTED_DWENGO_LEARNING_OBJECT_TITLE = 'Werken met notebooks';
const DWENGO_TEST_LEARNING_OBJECT_ID: LearningObjectIdentifier = {
@ -105,7 +105,10 @@ describe('LearningObjectService', () => {
expect(new Set(result.map((it) => it.key))).toEqual(DWENGO_TEST_LEARNING_PATH_HRUIDS);
});
it('returns an empty list when queried with a non-existing learning path id', async () => {
const result = await learningObjectService.getLearningObjectsFromPath({ hruid: 'non_existing', language: Language.Dutch });
const result = await learningObjectService.getLearningObjectsFromPath({
hruid: 'non_existing',
language: Language.Dutch,
});
expect(result).toEqual([]);
});
});
@ -120,7 +123,10 @@ describe('LearningObjectService', () => {
expect(new Set(result)).toEqual(DWENGO_TEST_LEARNING_PATH_HRUIDS);
});
it('returns an empty list when queried with a non-existing learning path id', async () => {
const result = await learningObjectService.getLearningObjectIdsFromPath({ hruid: 'non_existing', language: Language.Dutch });
const result = await learningObjectService.getLearningObjectIdsFromPath({
hruid: 'non_existing',
language: Language.Dutch,
});
expect(result).toEqual([]);
});
});

View file

@ -19,7 +19,8 @@ import {
createConditionTestLearningPathAndLearningObjects,
} from '../../test-assets/learning-paths/test-conditions-example.js';
import { Student } from '../../../src/entities/users/student.entity.js';
import { LearningObjectNode, LearningPathResponse } from '../../../src/interfaces/learning-content.js';
import { LearningObjectNode, LearningPathResponse } from 'dwengo-1-common/src/interfaces/learning-content';
async function initExampleData(): Promise<{ learningObject: LearningObject; learningPath: LearningPath }> {
const learningObjectRepo = getLearningObjectRepository();

View file

@ -1,8 +1,8 @@
import { AssertionError } from 'node:assert';
import { LearningObject } from '../../src/entities/content/learning-object.entity';
import { FilteredLearningObject, LearningPath } from '../../src/interfaces/learning-content';
import { LearningPath as LearningPathEntity } from '../../src/entities/content/learning-path.entity';
import { expect } from 'vitest';
import { FilteredLearningObject, LearningPath } from 'dwengo-1-common/src/interfaces/learning-content';
// Ignored properties because they belang for example to the class, not to the entity itself.
const IGNORE_PROPERTIES = ['parent'];