style: fix linting issues met Prettier
This commit is contained in:
		
							parent
							
								
									af8c783a26
								
							
						
					
					
						commit
						5168ceaee0
					
				
					 56 changed files with 680 additions and 741 deletions
				
			
		|  | @ -4,18 +4,12 @@ import { LearningObject } from '../../../src/entities/content/learning-object.en | |||
| import databaseLearningObjectProvider from '../../../src/services/learning-objects/database-learning-object-provider'; | ||||
| import { expectToBeCorrectFilteredLearningObject } from '../../test-utils/expectations'; | ||||
| import { Language } from '@dwengo-1/common/util/language'; | ||||
| import { | ||||
|     FilteredLearningObject, | ||||
|     LearningObjectNode, | ||||
|     LearningPathIdentifier | ||||
| } from '@dwengo-1/common/interfaces/learning-content'; | ||||
| import { | ||||
|     testPartiallyDatabaseAndPartiallyDwengoApiLearningPath | ||||
| } from "../../test_assets/content/learning-paths.testdata"; | ||||
| import {testLearningObjectPnNotebooks} from "../../test_assets/content/learning-objects.testdata"; | ||||
| import { FilteredLearningObject, LearningObjectNode, LearningPathIdentifier } from '@dwengo-1/common/interfaces/learning-content'; | ||||
| import { testPartiallyDatabaseAndPartiallyDwengoApiLearningPath } from '../../test_assets/content/learning-paths.testdata'; | ||||
| import { testLearningObjectPnNotebooks } from '../../test_assets/content/learning-objects.testdata'; | ||||
| import { LearningPath } from '@dwengo-1/common/dist/interfaces/learning-content'; | ||||
| import {RequiredEntityData} from "@mikro-orm/core"; | ||||
| import {getHtmlRenderingForTestLearningObject} from "../../test-utils/get-html-rendering"; | ||||
| import { RequiredEntityData } from '@mikro-orm/core'; | ||||
| import { getHtmlRenderingForTestLearningObject } from '../../test-utils/get-html-rendering'; | ||||
| 
 | ||||
| const EXPECTED_TITLE_FROM_DWENGO_LEARNING_OBJECT = 'Notebook opslaan'; | ||||
| 
 | ||||
|  | @ -31,7 +25,7 @@ describe('DatabaseLearningObjectProvider', () => { | |||
| 
 | ||||
|         exampleLearningPathId = { | ||||
|             hruid: exampleLearningPath.hruid, | ||||
|             language: exampleLearningPath.language as Language | ||||
|             language: exampleLearningPath.language as Language, | ||||
|         }; | ||||
|     }); | ||||
|     describe('getLearningObjectById', () => { | ||||
|  | @ -75,9 +69,7 @@ describe('DatabaseLearningObjectProvider', () => { | |||
|     describe('getLearningObjectIdsFromPath', () => { | ||||
|         it('should return all learning object IDs from a path', async () => { | ||||
|             const result = await databaseLearningObjectProvider.getLearningObjectIdsFromPath(exampleLearningPathId); | ||||
|             expect(new Set(result)).toEqual( | ||||
|                 new Set(exampleLearningPath.nodes.map((it: LearningObjectNode) => it.learningobject_hruid)) | ||||
|             ); | ||||
|             expect(new Set(result)).toEqual(new Set(exampleLearningPath.nodes.map((it: LearningObjectNode) => it.learningobject_hruid))); | ||||
|         }); | ||||
|         it('should throw an error if queried with a path identifier for which there is no learning path', async () => { | ||||
|             await expect( | ||||
|  |  | |||
|  | @ -3,18 +3,12 @@ import { setupTestApp } from '../../setup-tests'; | |||
| import { LearningObject } from '../../../src/entities/content/learning-object.entity'; | ||||
| import learningObjectService from '../../../src/services/learning-objects/learning-object-service'; | ||||
| import { envVars, getEnvVar } from '../../../src/util/envVars'; | ||||
| import { | ||||
|     LearningObjectIdentifierDTO, | ||||
|     LearningPath as LearningPathDTO, | ||||
|     LearningPathIdentifier | ||||
| } from '@dwengo-1/common/interfaces/learning-content'; | ||||
| import { LearningObjectIdentifierDTO, LearningPath as LearningPathDTO, LearningPathIdentifier } from '@dwengo-1/common/interfaces/learning-content'; | ||||
| import { Language } from '@dwengo-1/common/util/language'; | ||||
| import {testLearningObjectPnNotebooks} from "../../test_assets/content/learning-objects.testdata"; | ||||
| import { | ||||
|     testPartiallyDatabaseAndPartiallyDwengoApiLearningPath | ||||
| } from "../../test_assets/content/learning-paths.testdata"; | ||||
| import {RequiredEntityData} from "@mikro-orm/core"; | ||||
| import {getHtmlRenderingForTestLearningObject} from "../../test-utils/get-html-rendering"; | ||||
| import { testLearningObjectPnNotebooks } from '../../test_assets/content/learning-objects.testdata'; | ||||
| import { testPartiallyDatabaseAndPartiallyDwengoApiLearningPath } from '../../test_assets/content/learning-paths.testdata'; | ||||
| import { RequiredEntityData } from '@mikro-orm/core'; | ||||
| import { getHtmlRenderingForTestLearningObject } from '../../test-utils/get-html-rendering'; | ||||
| 
 | ||||
| const EXPECTED_DWENGO_LEARNING_OBJECT_TITLE = 'Werken met notebooks'; | ||||
| const DWENGO_TEST_LEARNING_OBJECT_ID: LearningObjectIdentifierDTO = { | ||||
|  | @ -41,8 +35,8 @@ describe('LearningObjectService', () => { | |||
| 
 | ||||
|         exampleLearningPathId = { | ||||
|             hruid: exampleLearningPath.hruid, | ||||
|             language: exampleLearningPath.language as Language | ||||
|         } | ||||
|             language: exampleLearningPath.language as Language, | ||||
|         }; | ||||
|     }); | ||||
| 
 | ||||
|     describe('getLearningObjectById', () => { | ||||
|  | @ -99,9 +93,7 @@ describe('LearningObjectService', () => { | |||
|     describe('getLearningObjectsFromPath', () => { | ||||
|         it('returns all learning objects when a learning path in the database is queried', async () => { | ||||
|             const result = await learningObjectService.getLearningObjectsFromPath(exampleLearningPathId); | ||||
|             expect(result.map(it=> it.key)).toEqual( | ||||
|                 exampleLearningPath.nodes.map(it => it.learningobject_hruid) | ||||
|             ); | ||||
|             expect(result.map((it) => it.key)).toEqual(exampleLearningPath.nodes.map((it) => it.learningobject_hruid)); | ||||
|         }); | ||||
|         it('also returns all learning objects when a learning path from the Dwengo API is queried', async () => { | ||||
|             const result = await learningObjectService.getLearningObjectsFromPath(DWENGO_TEST_LEARNING_PATH_ID); | ||||
|  | @ -119,7 +111,7 @@ describe('LearningObjectService', () => { | |||
|     describe('getLearningObjectIdsFromPath', () => { | ||||
|         it('returns all learning objects when a learning path in the database is queried', async () => { | ||||
|             const result = await learningObjectService.getLearningObjectIdsFromPath(exampleLearningPathId); | ||||
|             expect(result).toEqual(exampleLearningPath.nodes.map(it => it.learningobject_hruid)); | ||||
|             expect(result).toEqual(exampleLearningPath.nodes.map((it) => it.learningobject_hruid)); | ||||
|         }); | ||||
|         it('also returns all learning object hruids when a learning path from the Dwengo API is queried', async () => { | ||||
|             const result = await learningObjectService.getLearningObjectIdsFromPath(DWENGO_TEST_LEARNING_PATH_ID); | ||||
|  |  | |||
|  | @ -1,12 +1,13 @@ | |||
| import {beforeAll, describe, expect, it} from 'vitest'; | ||||
| import { beforeAll, describe, expect, it } from 'vitest'; | ||||
| import processingService from '../../../../src/services/learning-objects/processing/processing-service'; | ||||
| import { | ||||
|     testLearningObjectEssayQuestion, | ||||
|     testLearningObjectMultipleChoice, testLearningObjectPnNotebooks | ||||
| } from "../../../test_assets/content/learning-objects.testdata"; | ||||
| import {getHtmlRenderingForTestLearningObject} from "../../../test-utils/get-html-rendering"; | ||||
| import {getLearningObjectRepository} from "../../../../src/data/repositories"; | ||||
| import {setupTestApp} from "../../../setup-tests"; | ||||
|     testLearningObjectMultipleChoice, | ||||
|     testLearningObjectPnNotebooks, | ||||
| } from '../../../test_assets/content/learning-objects.testdata'; | ||||
| import { getHtmlRenderingForTestLearningObject } from '../../../test-utils/get-html-rendering'; | ||||
| import { getLearningObjectRepository } from '../../../../src/data/repositories'; | ||||
| import { setupTestApp } from '../../../setup-tests'; | ||||
| 
 | ||||
| describe('ProcessingService', () => { | ||||
|     beforeAll(async () => { | ||||
|  | @ -17,24 +18,18 @@ describe('ProcessingService', () => { | |||
|         const markdownLearningObject = getLearningObjectRepository().create(testLearningObjectPnNotebooks); | ||||
|         const result = await processingService.render(markdownLearningObject); | ||||
|         // Set newlines so your tests are platform-independent.
 | ||||
|         expect(result).toEqual( | ||||
|             getHtmlRenderingForTestLearningObject(markdownLearningObject).replace(/\r\n/g, '\n') | ||||
|         ); | ||||
|         expect(result).toEqual(getHtmlRenderingForTestLearningObject(markdownLearningObject).replace(/\r\n/g, '\n')); | ||||
|     }); | ||||
| 
 | ||||
|     it('renders a multiple choice question correctly', async () => { | ||||
|         const testLearningObject = getLearningObjectRepository().create(testLearningObjectMultipleChoice); | ||||
|         const result = await processingService.render(testLearningObject); | ||||
|         expect(result).toEqual( | ||||
|             getHtmlRenderingForTestLearningObject(testLearningObjectMultipleChoice).replace(/\r\n/g, '\n') | ||||
|         ); | ||||
|         expect(result).toEqual(getHtmlRenderingForTestLearningObject(testLearningObjectMultipleChoice).replace(/\r\n/g, '\n')); | ||||
|     }); | ||||
| 
 | ||||
|     it('renders an essay question correctly', async () => { | ||||
|         const essayLearningObject = getLearningObjectRepository().create(testLearningObjectEssayQuestion); | ||||
|         const result = await processingService.render(essayLearningObject); | ||||
|         expect(result).toEqual( | ||||
|             getHtmlRenderingForTestLearningObject(essayLearningObject).replace(/\r\n/g, '\n') | ||||
|         ); | ||||
|         expect(result).toEqual(getHtmlRenderingForTestLearningObject(essayLearningObject).replace(/\r\n/g, '\n')); | ||||
|     }); | ||||
| }); | ||||
|  |  | |||
		Reference in a new issue
	
	 Lint Action
						Lint Action