refactor(common): Language
This commit is contained in:
		
							parent
							
								
									5a90862098
								
							
						
					
					
						commit
						bef6c6f75b
					
				
					 48 changed files with 71 additions and 56 deletions
				
			
		|  | @ -1,15 +1,15 @@ | |||
| import { beforeAll, describe, expect, it } from 'vitest'; | ||||
| import { Language } from 'dwengo-1-common/src/util/language'; | ||||
| import { setupTestApp } from '../../setup-tests'; | ||||
| import { getLearningObjectRepository, getLearningPathRepository } from '../../../src/data/repositories'; | ||||
| import example from '../../test-assets/learning-objects/pn-werkingnotebooks/pn-werkingnotebooks-example'; | ||||
| import learningObjectExample from '../../test-assets/learning-objects/pn-werkingnotebooks/pn-werkingnotebooks-example'; | ||||
| 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 { 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"; | ||||
| import { FilteredLearningObject } from 'dwengo-1-common/src/interfaces/learning-content'; | ||||
| 
 | ||||
| async function initExampleData(): Promise<{ learningObject: LearningObject; learningPath: LearningPath }> { | ||||
|     const learningObjectRepo = getLearningObjectRepository(); | ||||
|  |  | |||
|  | @ -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([]); | ||||
|         }); | ||||
|     }); | ||||
|  |  | |||
|  | @ -1,4 +1,5 @@ | |||
| import { beforeAll, describe, expect, it } from 'vitest'; | ||||
| import { Language } from 'dwengo-1-common/src/util/language'; | ||||
| import { LearningObject } from '../../../src/entities/content/learning-object.entity.js'; | ||||
| import { setupTestApp } from '../../setup-tests.js'; | ||||
| import { LearningPath } from '../../../src/entities/content/learning-path.entity.js'; | ||||
|  | @ -13,14 +14,13 @@ import learningPathExample from '../../test-assets/learning-paths/pn-werking-exa | |||
| import databaseLearningPathProvider from '../../../src/services/learning-paths/database-learning-path-provider.js'; | ||||
| import { expectToBeCorrectLearningPath } from '../../test-utils/expectations.js'; | ||||
| import learningObjectService from '../../../src/services/learning-objects/learning-object-service.js'; | ||||
| import { Language } from '../../../src/entities/content/language.js'; | ||||
| import { | ||||
|     ConditionTestLearningPathAndLearningObjects, | ||||
|     createConditionTestLearningPathAndLearningObjects, | ||||
| } from '../../test-assets/learning-paths/test-conditions-example.js'; | ||||
| import { Student } from '../../../src/entities/users/student.entity.js'; | ||||
| 
 | ||||
| import {LearningObjectNode, LearningPathResponse} from "dwengo-1-common/src/interfaces/learning-content"; | ||||
| import { LearningObjectNode, LearningPathResponse } from 'dwengo-1-common/src/interfaces/learning-content'; | ||||
| 
 | ||||
| async function initExampleData(): Promise<{ learningObject: LearningObject; learningPath: LearningPath }> { | ||||
|     const learningObjectRepo = getLearningObjectRepository(); | ||||
|  | @ -105,7 +105,11 @@ function expectBranchingObjectNode( | |||
| 
 | ||||
| describe('DatabaseLearningPathProvider', () => { | ||||
|     let example: { learningObject: LearningObject; learningPath: LearningPath }; | ||||
|     let persTestData: { learningContent: ConditionTestLearningPathAndLearningObjects; studentA: Student; studentB: Student }; | ||||
|     let persTestData: { | ||||
|         learningContent: ConditionTestLearningPathAndLearningObjects; | ||||
|         studentA: Student; | ||||
|         studentB: Student; | ||||
|     }; | ||||
| 
 | ||||
|     beforeAll(async () => { | ||||
|         await setupTestApp(); | ||||
|  |  | |||
|  | @ -1,11 +1,11 @@ | |||
| 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 { LearningPath } from '../../../src/entities/content/learning-path.entity'; | ||||
| import { getLearningObjectRepository, getLearningPathRepository } from '../../../src/data/repositories'; | ||||
| import learningObjectExample from '../../test-assets/learning-objects/pn-werkingnotebooks/pn-werkingnotebooks-example'; | ||||
| import learningPathExample from '../../test-assets/learning-paths/pn-werking-example'; | ||||
| import { Language } from '../../../src/entities/content/language'; | ||||
| import learningPathService from '../../../src/services/learning-paths/learning-path-service'; | ||||
| 
 | ||||
| async function initExampleData(): Promise<{ learningObject: LearningObject; learningPath: LearningPath }> { | ||||
|  |  | |||
		Reference in a new issue