refactor(common): Language

This commit is contained in:
Tibo De Peuter 2025-03-31 22:23:25 +02:00
parent 5a90862098
commit bef6c6f75b
Signed by: tdpeuter
GPG key ID: 38297DE43F75FFE2
48 changed files with 71 additions and 56 deletions

View file

@ -1,14 +1,14 @@
import { beforeAll, describe, expect, it } from 'vitest';
import { Language } from 'dwengo-1-common/src/util/language';
import { setupTestApp } from '../../setup-tests';
import { LearningObject } from '../../../src/entities/content/learning-object.entity';
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 { 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";
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([]);
});
});