style: fix linting issues met Prettier
This commit is contained in:
		
							parent
							
								
									af8c783a26
								
							
						
					
					
						commit
						5168ceaee0
					
				
					 56 changed files with 680 additions and 741 deletions
				
			
		|  | @ -33,8 +33,7 @@ describe('AssignmentRepository', () => { | |||
| 
 | ||||
|     it('should find all by username of the responsible teacher', async () => { | ||||
|         const result = await assignmentRepository.findAllByResponsibleTeacher('testleerkracht1'); | ||||
|         const resultIds = result.map((it) => it.id) | ||||
|             .sort((a, b) => (a ?? 0) - (b ?? 0)); | ||||
|         const resultIds = result.map((it) => it.id).sort((a, b) => (a ?? 0) - (b ?? 0)); | ||||
| 
 | ||||
|         expect(resultIds).toEqual([1, 1, 3, 4]); | ||||
|     }); | ||||
|  |  | |||
|  | @ -91,11 +91,9 @@ describe('SubmissionRepository', () => { | |||
|         expect(result[2].submissionNumber).toBe(3); | ||||
|     }); | ||||
| 
 | ||||
|     it("should find only the submissions for a certain learning object and assignment made for the given group", async () => { | ||||
|     it('should find only the submissions for a certain learning object and assignment made for the given group', async () => { | ||||
|         const group = await groupRepository.findByAssignmentAndGroupNumber(assignment!, 2); | ||||
|         const result = await submissionRepository.findAllSubmissionsForLearningObjectAndGroup( | ||||
|             loId, group! | ||||
|         ); | ||||
|         const result = await submissionRepository.findAllSubmissionsForLearningObjectAndGroup(loId, group!); | ||||
| 
 | ||||
|         expect(result).toHaveLength(1); | ||||
| 
 | ||||
|  |  | |||
|  | @ -5,8 +5,8 @@ import { AttachmentRepository } from '../../../src/data/content/attachment-repos | |||
| import { LearningObject } from '../../../src/entities/content/learning-object.entity.js'; | ||||
| import { Attachment } from '../../../src/entities/content/attachment.entity.js'; | ||||
| import { LearningObjectIdentifier } from '../../../src/entities/content/learning-object-identifier.js'; | ||||
| import {testLearningObjectPnNotebooks} from "../../test_assets/content/learning-objects.testdata"; | ||||
| import {v4 as uuidV4} from "uuid"; | ||||
| import { testLearningObjectPnNotebooks } from '../../test_assets/content/learning-objects.testdata'; | ||||
| import { v4 as uuidV4 } from 'uuid'; | ||||
| 
 | ||||
| describe('AttachmentRepository', () => { | ||||
|     let attachmentRepo: AttachmentRepository; | ||||
|  | @ -26,7 +26,7 @@ describe('AttachmentRepository', () => { | |||
|         newLearningObjectData.version = 101; | ||||
|         newLearningObjectData.attachments = []; | ||||
|         newLearningObjectData.uuid = uuidV4(); | ||||
|         newLearningObjectData.content = Buffer.from("Content of the newer example"); | ||||
|         newLearningObjectData.content = Buffer.from('Content of the newer example'); | ||||
| 
 | ||||
|         newLearningObject = learningObjectRepo.create(newLearningObjectData); | ||||
|         await learningObjectRepo.save(newLearningObject); | ||||
|  | @ -36,7 +36,7 @@ describe('AttachmentRepository', () => { | |||
|     it('allows us to add attachments with the same name to a different learning object without throwing an error', async () => { | ||||
|         attachmentOnlyNewer = structuredClone(attachmentsOlderLearningObject[0]); | ||||
|         attachmentOnlyNewer.learningObject = newLearningObject; | ||||
|         attachmentOnlyNewer.content = Buffer.from("New attachment content"); | ||||
|         attachmentOnlyNewer.content = Buffer.from('New attachment content'); | ||||
| 
 | ||||
|         await attachmentRepo.save(attachmentRepo.create(attachmentOnlyNewer)); | ||||
|     }); | ||||
|  | @ -49,10 +49,7 @@ describe('AttachmentRepository', () => { | |||
|             version: testLearningObjectPnNotebooks.version, | ||||
|         }; | ||||
| 
 | ||||
|         const result = await attachmentRepo.findByLearningObjectIdAndName( | ||||
|             olderLearningObjectId, | ||||
|             attachmentsOlderLearningObject[0].name | ||||
|         ); | ||||
|         const result = await attachmentRepo.findByLearningObjectIdAndName(olderLearningObjectId, attachmentsOlderLearningObject[0].name); | ||||
|         expect(result).not.toBeNull(); | ||||
|         expect(result!.name).toEqual(attachmentsOlderLearningObject[0].name); | ||||
|         expect(result!.content).toEqual(attachmentsOlderLearningObject[0].content); | ||||
|  |  | |||
|  | @ -2,7 +2,7 @@ import { beforeAll, describe, expect, it } from 'vitest'; | |||
| import { setupTestApp } from '../../setup-tests.js'; | ||||
| import { getAttachmentRepository } from '../../../src/data/repositories.js'; | ||||
| import { AttachmentRepository } from '../../../src/data/content/attachment-repository.js'; | ||||
| import { testLearningObject02 } from "../../test_assets/content/learning-objects.testdata"; | ||||
| import { testLearningObject02 } from '../../test_assets/content/learning-objects.testdata'; | ||||
| 
 | ||||
| describe('AttachmentRepository', () => { | ||||
|     let attachmentRepository: AttachmentRepository; | ||||
|  |  | |||
|  | @ -4,12 +4,8 @@ import { setupTestApp } from '../../setup-tests.js'; | |||
| import { getLearningObjectRepository } from '../../../src/data/repositories.js'; | ||||
| import { LearningObject } from '../../../src/entities/content/learning-object.entity.js'; | ||||
| import { expectToBeCorrectEntity } from '../../test-utils/expectations.js'; | ||||
| import { | ||||
|     testLearningObject01, | ||||
|     testLearningObject02, | ||||
|     testLearningObject03 | ||||
| } from "../../test_assets/content/learning-objects.testdata"; | ||||
| import {v4} from "uuid"; | ||||
| import { testLearningObject01, testLearningObject02, testLearningObject03 } from '../../test_assets/content/learning-objects.testdata'; | ||||
| import { v4 } from 'uuid'; | ||||
| 
 | ||||
| describe('LearningObjectRepository', () => { | ||||
|     let learningObjectRepository: LearningObjectRepository; | ||||
|  | @ -43,26 +39,22 @@ describe('LearningObjectRepository', () => { | |||
|     it('should allow a learning object with the same id except a different version to be added', async () => { | ||||
|         const testLearningObject01Newer = structuredClone(testLearningObject01); | ||||
|         testLearningObject01Newer.version = 10; | ||||
|         testLearningObject01Newer.title += " (nieuw)"; | ||||
|         testLearningObject01Newer.title += ' (nieuw)'; | ||||
|         testLearningObject01Newer.uuid = v4(); | ||||
|         testLearningObject01Newer.content = Buffer.from("This is the new content."); | ||||
|         testLearningObject01Newer.content = Buffer.from('This is the new content.'); | ||||
|         newerExample = learningObjectRepository.create(testLearningObject01Newer); | ||||
|         await learningObjectRepository.save(newerExample); | ||||
|     }); | ||||
| 
 | ||||
|     it('should return the newest version of the learning object when queried by only hruid and language', async () => { | ||||
|         const result = await learningObjectRepository.findLatestByHruidAndLanguage( | ||||
|             newerExample.hruid, newerExample.language | ||||
|         ); | ||||
|         const result = await learningObjectRepository.findLatestByHruidAndLanguage(newerExample.hruid, newerExample.language); | ||||
|         expect(result).toBeInstanceOf(LearningObject); | ||||
|         expect(result?.version).toBe(10); | ||||
|         expect(result?.title).toContain('(nieuw)'); | ||||
|     }); | ||||
| 
 | ||||
|     it('should return null when queried by non-existing hruid or language', async () => { | ||||
|         const result = await learningObjectRepository.findLatestByHruidAndLanguage( | ||||
|             'something_that_does_not_exist', testLearningObject01.language | ||||
|         ); | ||||
|         const result = await learningObjectRepository.findLatestByHruidAndLanguage('something_that_does_not_exist', testLearningObject01.language); | ||||
|         expect(result).toBe(null); | ||||
|     }); | ||||
| }); | ||||
|  |  | |||
|  | @ -4,7 +4,7 @@ import { getLearningObjectRepository } from '../../../src/data/repositories'; | |||
| import { setupTestApp } from '../../setup-tests'; | ||||
| import { LearningObjectIdentifier } from '../../../src/entities/content/learning-object-identifier'; | ||||
| import { Language } from '@dwengo-1/common/util/language'; | ||||
| import {testLearningObject01} from "../../test_assets/content/learning-objects.testdata"; | ||||
| import { testLearningObject01 } from '../../test_assets/content/learning-objects.testdata'; | ||||
| 
 | ||||
| describe('LearningObjectRepository', () => { | ||||
|     let learningObjectRepository: LearningObjectRepository; | ||||
|  |  | |||
|  | @ -3,14 +3,10 @@ import { setupTestApp } from '../../setup-tests.js'; | |||
| import { getLearningPathRepository } from '../../../src/data/repositories.js'; | ||||
| import { LearningPathRepository } from '../../../src/data/content/learning-path-repository.js'; | ||||
| import { LearningPath } from '../../../src/entities/content/learning-path.entity.js'; | ||||
| import { | ||||
|     expectToBeCorrectEntity, | ||||
|     expectToHaveFoundNothing, | ||||
|     expectToHaveFoundPrecisely | ||||
| } from '../../test-utils/expectations.js'; | ||||
| import { expectToBeCorrectEntity, expectToHaveFoundNothing, expectToHaveFoundPrecisely } from '../../test-utils/expectations.js'; | ||||
| import { Language } from '@dwengo-1/common/util/language'; | ||||
| import {testLearningPath01} from "../../test_assets/content/learning-paths.testdata"; | ||||
| import {mapToLearningPath} from "../../../src/services/learning-paths/learning-path-service"; | ||||
| import { testLearningPath01 } from '../../test_assets/content/learning-paths.testdata'; | ||||
| import { mapToLearningPath } from '../../../src/services/learning-paths/learning-path-service'; | ||||
| 
 | ||||
| describe('LearningPathRepository', () => { | ||||
|     let learningPathRepo: LearningPathRepository; | ||||
|  | @ -24,10 +20,7 @@ describe('LearningPathRepository', () => { | |||
|     }); | ||||
| 
 | ||||
|     it('should return a learning path when it is queried by hruid and language', async () => { | ||||
|         const result = await learningPathRepo.findByHruidAndLanguage( | ||||
|             testLearningPath01.hruid, | ||||
|             testLearningPath01.language as Language | ||||
|         ); | ||||
|         const result = await learningPathRepo.findByHruidAndLanguage(testLearningPath01.hruid, testLearningPath01.language as Language); | ||||
|         expect(result).toBeInstanceOf(LearningPath); | ||||
|         expectToBeCorrectEntity(result!, examplePath); | ||||
|     }); | ||||
|  |  | |||
|  | @ -3,7 +3,7 @@ import { getLearningPathRepository } from '../../../src/data/repositories'; | |||
| import { LearningPathRepository } from '../../../src/data/content/learning-path-repository'; | ||||
| import { setupTestApp } from '../../setup-tests'; | ||||
| import { Language } from '@dwengo-1/common/util/language'; | ||||
| import {testLearningPath01} from "../../test_assets/content/learning-paths.testdata"; | ||||
| import { testLearningPath01 } from '../../test_assets/content/learning-paths.testdata'; | ||||
| 
 | ||||
| describe('LearningPathRepository', () => { | ||||
|     let learningPathRepository: LearningPathRepository; | ||||
|  | @ -20,9 +20,7 @@ describe('LearningPathRepository', () => { | |||
|     }); | ||||
| 
 | ||||
|     it('should return requested learning path', async () => { | ||||
|         const learningPath = await learningPathRepository.findByHruidAndLanguage( | ||||
|             testLearningPath01.hruid, testLearningPath01.language as Language | ||||
|         ); | ||||
|         const learningPath = await learningPathRepository.findByHruidAndLanguage(testLearningPath01.hruid, testLearningPath01.language as Language); | ||||
| 
 | ||||
|         expect(learningPath).toBeTruthy(); | ||||
|         expect(learningPath?.title).toBe(testLearningPath01.title); | ||||
|  |  | |||
		Reference in a new issue
	
	 Lint Action
						Lint Action