style: format en linting
This commit is contained in:
		
							parent
							
								
									4cb1469479
								
							
						
					
					
						commit
						e2bf413f35
					
				
					 22 changed files with 41 additions and 71 deletions
				
			
		|  | @ -2,7 +2,7 @@ import { beforeAll, describe, expect, it } from 'vitest'; | |||
| import { setupTestApp } from '../../setup-tests'; | ||||
| import { AssignmentRepository } from '../../../src/data/assignments/assignment-repository'; | ||||
| import { getAssignmentRepository } from '../../../src/data/repositories'; | ||||
| import { getClass01, getClass02 } from '../../test_assets/classes/classes.testdata'; | ||||
| import { getClass02 } from '../../test_assets/classes/classes.testdata'; | ||||
| import { getAssignment02, getAssignment03 } from '../../test_assets/assignments/assignments.testdata'; | ||||
| import { getTestleerkracht1 } from '../../test_assets/users/teachers.testdata'; | ||||
| 
 | ||||
|  | @ -17,7 +17,7 @@ describe('AssignmentRepository', () => { | |||
|     it('should return the requested assignment', async () => { | ||||
|         const class_ = getClass02(); | ||||
|         const usedAssignment = getAssignment02(); | ||||
|         const assignment = await assignmentRepository.findByClassAndId(class_!, 21001); | ||||
|         const assignment = await assignmentRepository.findByClassAndId(class_, 21001); | ||||
| 
 | ||||
|         expect(assignment).toBeTruthy(); | ||||
|         expect(assignment!.description).toBe(usedAssignment.description); | ||||
|  | @ -30,7 +30,7 @@ describe('AssignmentRepository', () => { | |||
|     it('should return all assignments for a class', async () => { | ||||
|         const class_ = getClass02(); | ||||
|         const usedAssignment = getAssignment02(); | ||||
|         const assignments = await assignmentRepository.findAllAssignmentsInClass(class_!); | ||||
|         const assignments = await assignmentRepository.findAllAssignmentsInClass(class_); | ||||
| 
 | ||||
|         expect(assignments).toBeTruthy(); | ||||
|         expect(assignments).toHaveLength(1); | ||||
|  |  | |||
|  | @ -1,8 +1,7 @@ | |||
| import { beforeAll, describe, expect, it } from 'vitest'; | ||||
| import { setupTestApp } from '../../setup-tests'; | ||||
| import { GroupRepository } from '../../../src/data/assignments/group-repository'; | ||||
| import { getAssignmentRepository, getClassRepository, getGroupRepository } from '../../../src/data/repositories'; | ||||
| import { getClass01 } from '../../test_assets/classes/classes.testdata'; | ||||
| import { getGroupRepository } from '../../../src/data/repositories'; | ||||
| import { getAssignment01, getAssignment02 } from '../../test_assets/assignments/assignments.testdata'; | ||||
| import { getTestGroup01, getTestGroup02, getTestGroup03 } from '../../test_assets/assignments/groups.testdata'; | ||||
| import { getDireStraits, getNoordkaap } from '../../test_assets/users/students.testdata'; | ||||
|  | @ -21,7 +20,7 @@ describe('GroupRepository', () => { | |||
|         const member1 = getNoordkaap(); | ||||
|         const member2 = getDireStraits(); | ||||
| 
 | ||||
|         const group = await groupRepository.findByAssignmentAndGroupNumber(assignment!, usedGroup.groupNumber!); | ||||
|         const group = await groupRepository.findByAssignmentAndGroupNumber(assignment, usedGroup.groupNumber!); | ||||
| 
 | ||||
|         expect(group).toBeTruthy(); | ||||
|         expect(group?.groupNumber).toBe(usedGroup.groupNumber); | ||||
|  | @ -36,7 +35,7 @@ describe('GroupRepository', () => { | |||
|         const gr2 = getTestGroup02(); | ||||
|         const gr3 = getTestGroup03(); | ||||
| 
 | ||||
|         const groups = await groupRepository.findAllGroupsForAssignment(assignment!); | ||||
|         const groups = await groupRepository.findAllGroupsForAssignment(assignment); | ||||
| 
 | ||||
|         expect(groups).toBeTruthy(); | ||||
|         expect(groups).toHaveLength(3); | ||||
|  | @ -49,9 +48,9 @@ describe('GroupRepository', () => { | |||
|         const assignment = getAssignment02(); | ||||
|         const deleted = getTestGroup01(); | ||||
| 
 | ||||
|         await groupRepository.deleteByAssignmentAndGroupNumber(assignment!, deleted.groupNumber!); | ||||
|         await groupRepository.deleteByAssignmentAndGroupNumber(assignment, deleted.groupNumber!); | ||||
| 
 | ||||
|         const group = await groupRepository.findByAssignmentAndGroupNumber(assignment!, deleted.groupNumber!); | ||||
|         const group = await groupRepository.findByAssignmentAndGroupNumber(assignment, deleted.groupNumber!); | ||||
| 
 | ||||
|         expect(group).toBeNull(); | ||||
|     }); | ||||
|  |  | |||
|  | @ -2,20 +2,12 @@ import { beforeAll, describe, expect, it } from 'vitest'; | |||
| import { setupTestApp } from '../../setup-tests'; | ||||
| import { SubmissionRepository } from '../../../src/data/assignments/submission-repository'; | ||||
| import { | ||||
|     getAssignmentRepository, | ||||
|     getClassRepository, | ||||
|     getGroupRepository, | ||||
|     getStudentRepository, | ||||
|     getSubmissionRepository, | ||||
| } from '../../../src/data/repositories'; | ||||
| import { LearningObjectIdentifier } from '../../../src/entities/content/learning-object-identifier'; | ||||
| import { Language } from '@dwengo-1/common/util/language'; | ||||
| import { Submission } from '../../../src/entities/assignments/submission.entity'; | ||||
| import { Class } from '../../../src/entities/classes/class.entity'; | ||||
| import { Assignment } from '../../../src/entities/assignments/assignment.entity'; | ||||
| import { testLearningObject01, testLearningObject03 } from '../../test_assets/content/learning-objects.testdata'; | ||||
| import { testLearningObject01 } from '../../test_assets/content/learning-objects.testdata'; | ||||
| import { getSubmission01, getSubmission02, getSubmission07, getSubmission08 } from '../../test_assets/assignments/submission.testdata'; | ||||
| import { use } from 'marked'; | ||||
| import { getAssignment01 } from '../../test_assets/assignments/assignments.testdata'; | ||||
| import { getTestGroup02 } from '../../test_assets/assignments/groups.testdata'; | ||||
| 
 | ||||
|  | @ -42,7 +34,7 @@ describe('SubmissionRepository', () => { | |||
|         const usedSubmission = getSubmission02(); | ||||
|         const id = new LearningObjectIdentifier(usedSubmission.learningObjectHruid, usedSubmission.learningObjectLanguage, usedSubmission.learningObjectVersion); | ||||
|          | ||||
|         const submission = await submissionRepository.findMostRecentSubmissionForStudent(id, usedSubmission.submitter!); | ||||
|         const submission = await submissionRepository.findMostRecentSubmissionForStudent(id, usedSubmission.submitter); | ||||
| 
 | ||||
|         expect(submission).toBeTruthy(); | ||||
|         expect(submission?.submissionTime).toStrictEqual(usedSubmission.submissionTime); | ||||
|  | @ -67,7 +59,7 @@ describe('SubmissionRepository', () => { | |||
|             language: usedSubmission.learningObjectLanguage, | ||||
|             version: usedSubmission.learningObjectVersion, | ||||
|         }; | ||||
|         const result = await submissionRepository.findAllSubmissionsForLearningObjectAndAssignment(loId, assignment!); | ||||
|         const result = await submissionRepository.findAllSubmissionsForLearningObjectAndAssignment(loId, assignment); | ||||
|         sortSubmissions(result); | ||||
| 
 | ||||
|         expect(result).toHaveLength(3); | ||||
|  | @ -94,7 +86,7 @@ describe('SubmissionRepository', () => { | |||
|             version: usedSubmission.learningObjectVersion, | ||||
|         }; | ||||
| 
 | ||||
|         const result = await submissionRepository.findAllSubmissionsForLearningObjectAndGroup(loId, group!); | ||||
|         const result = await submissionRepository.findAllSubmissionsForLearningObjectAndGroup(loId, group); | ||||
| 
 | ||||
|         expect(result).toHaveLength(1); | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| import { beforeAll, describe, expect, it } from 'vitest'; | ||||
| import { setupTestApp } from '../../setup-tests'; | ||||
| import { ClassJoinRequestRepository } from '../../../src/data/classes/class-join-request-repository'; | ||||
| import { getClassJoinRequestRepository, getClassRepository, getStudentRepository } from '../../../src/data/repositories'; | ||||
| import { getClassJoinRequestRepository } from '../../../src/data/repositories'; | ||||
| import { getPinkFloyd, getSmashingPumpkins } from '../../test_assets/users/students.testdata'; | ||||
| import { getClass02, getClass03 } from '../../test_assets/classes/classes.testdata'; | ||||
| import { getClassJoinRequest01, getClassJoinRequest02, getClassJoinRequest03 } from '../../test_assets/classes/class-join-requests.testdata'; | ||||
|  | @ -30,7 +30,7 @@ describe('ClassJoinRequestRepository', () => { | |||
|         const class_ = getClass02(); | ||||
|         const jr1 = getClassJoinRequest01(); | ||||
|         const jr2 = getClassJoinRequest02(); | ||||
|         const requests = await classJoinRequestRepository.findAllOpenRequestsTo(class_!); | ||||
|         const requests = await classJoinRequestRepository.findAllOpenRequestsTo(class_); | ||||
| 
 | ||||
|         expect(requests).toBeTruthy(); | ||||
|         expect(requests).toHaveLength(2); | ||||
|  | @ -41,9 +41,9 @@ describe('ClassJoinRequestRepository', () => { | |||
|     it('should not find a removed request', async () => { | ||||
|         const studentUsed = getSmashingPumpkins(); | ||||
|         const class_ = getClass03(); | ||||
|         await classJoinRequestRepository.deleteBy(studentUsed!, class_!); | ||||
|         await classJoinRequestRepository.deleteBy(studentUsed, class_); | ||||
| 
 | ||||
|         const request = await classJoinRequestRepository.findAllRequestsBy(studentUsed!); | ||||
|         const request = await classJoinRequestRepository.findAllRequestsBy(studentUsed); | ||||
| 
 | ||||
|         expect(request).toHaveLength(0); | ||||
|     }); | ||||
|  |  | |||
|  | @ -1,6 +1,6 @@ | |||
| import { beforeAll, describe, expect, it } from 'vitest'; | ||||
| import { setupTestApp } from '../../setup-tests'; | ||||
| import { getTeacherInvitationRepository, getTeacherRepository } from '../../../src/data/repositories'; | ||||
| import { getTeacherInvitationRepository } from '../../../src/data/repositories'; | ||||
| import { TeacherInvitationRepository } from '../../../src/data/classes/teacher-invitation-repository'; | ||||
| import { getFooFighters, getLimpBizkit } from '../../test_assets/users/teachers.testdata'; | ||||
| import { getTeacherInvitation01, getTeacherInvitation02, getTeacherInvitation03 } from '../../test_assets/classes/teacher-invitations.testdata'; | ||||
|  | @ -18,7 +18,7 @@ describe('ClassRepository', () => { | |||
|         const teacher = getLimpBizkit(); | ||||
|         const ti1 = getTeacherInvitation01(); | ||||
|         const ti2 = getTeacherInvitation02(); | ||||
|         const invitations = await teacherInvitationRepository.findAllInvitationsBy(teacher!); | ||||
|         const invitations = await teacherInvitationRepository.findAllInvitationsBy(teacher); | ||||
| 
 | ||||
|         expect(invitations).toBeTruthy(); | ||||
|         expect(invitations).toHaveLength(2); | ||||
|  | @ -30,7 +30,7 @@ describe('ClassRepository', () => { | |||
|         const teacher = getFooFighters(); | ||||
|         const ti1 = getTeacherInvitation01(); | ||||
|         const ti2 = getTeacherInvitation03(); | ||||
|         const invitations = await teacherInvitationRepository.findAllInvitationsFor(teacher!); | ||||
|         const invitations = await teacherInvitationRepository.findAllInvitationsFor(teacher); | ||||
| 
 | ||||
|         expect(invitations).toBeTruthy(); | ||||
|         expect(invitations).toHaveLength(2); | ||||
|  | @ -42,7 +42,7 @@ describe('ClassRepository', () => { | |||
|         const class_ = getClass02(); | ||||
|         const ti1 = getTeacherInvitation01(); | ||||
|         const ti2 = getTeacherInvitation02(); | ||||
|         const invitations = await teacherInvitationRepository.findAllInvitationsForClass(class_!); | ||||
|         const invitations = await teacherInvitationRepository.findAllInvitationsForClass(class_); | ||||
| 
 | ||||
|         expect(invitations).toBeTruthy(); | ||||
|         expect(invitations).toHaveLength(2); | ||||
|  | @ -55,9 +55,9 @@ describe('ClassRepository', () => { | |||
|         const class_ = getClass01(); | ||||
|         const sender = getFooFighters(); | ||||
|         const receiver = getLimpBizkit(); | ||||
|         await teacherInvitationRepository.deleteBy(class_!, sender!, receiver!); | ||||
|         await teacherInvitationRepository.deleteBy(class_, sender, receiver); | ||||
| 
 | ||||
|         const invitation = await teacherInvitationRepository.findAllInvitationsBy(sender!); | ||||
|         const invitation = await teacherInvitationRepository.findAllInvitationsBy(sender); | ||||
| 
 | ||||
|         expect(invitation).toHaveLength(0); | ||||
|     }); | ||||
|  |  | |||
|  | @ -2,7 +2,6 @@ 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 { getAttachment01 } from '../../test_assets/content/attachments.testdata.js'; | ||||
| 
 | ||||
| describe('AttachmentRepository', () => { | ||||
|  |  | |||
|  | @ -6,7 +6,6 @@ import { LearningObject } from '../../../src/entities/content/learning-object.en | |||
| import { expectToBeCorrectEntity } from '../../test-utils/expectations.js'; | ||||
| import { testLearningObject01, testLearningObject02, testLearningObject03 } from '../../test_assets/content/learning-objects.testdata'; | ||||
| import { v4 } from 'uuid'; | ||||
| import { wrap } from '@mikro-orm/core'; | ||||
| 
 | ||||
| describe('LearningObjectRepository', () => { | ||||
|     let learningObjectRepository: LearningObjectRepository; | ||||
|  | @ -38,7 +37,7 @@ describe('LearningObjectRepository', () => { | |||
|     let newerExample: LearningObject; | ||||
| 
 | ||||
|     it('should allow a learning object with the same id except a different version to be added', async () => { | ||||
|         // structeredClone failed on teacher, this copies all fields to a json object
 | ||||
|         // StructeredClone failed on teacher, this copies all fields to a json object
 | ||||
|         const testLearningObject01Newer = { ...testLearningObject01 }; | ||||
|         testLearningObject01Newer.version = 10; | ||||
|         testLearningObject01Newer.title += ' (nieuw)'; | ||||
|  | @ -48,15 +47,6 @@ describe('LearningObjectRepository', () => { | |||
|         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); | ||||
|         // 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); | ||||
|         expect(result).toBe(null); | ||||
|  |  | |||
|  | @ -1,15 +1,10 @@ | |||
| import { beforeAll, describe, expect, it } from 'vitest'; | ||||
| import { setupTestApp } from '../../setup-tests'; | ||||
| import { AnswerRepository } from '../../../src/data/questions/answer-repository'; | ||||
| import { getAnswerRepository, getQuestionRepository, getTeacherRepository } from '../../../src/data/repositories'; | ||||
| import { QuestionRepository } from '../../../src/data/questions/question-repository'; | ||||
| import { LearningObjectIdentifier } from '../../../src/entities/content/learning-object-identifier'; | ||||
| import { Language } from '@dwengo-1/common/util/language'; | ||||
| import { TeacherRepository } from '../../../src/data/users/teacher-repository'; | ||||
| import { getQuestion01, getQuestion02, getQuestion04, getQuestion05, getQuestion06 } from '../../test_assets/questions/questions.testdata'; | ||||
| import { getAnswerRepository } from '../../../src/data/repositories'; | ||||
| import { getQuestion01, getQuestion02 } from '../../test_assets/questions/questions.testdata'; | ||||
| import { getAnswer01, getAnswer02, getAnswer03 } from '../../test_assets/questions/answers.testdata'; | ||||
| import { getFooFighters } from '../../test_assets/users/teachers.testdata'; | ||||
| import { testLearningObject05 } from '../../test_assets/content/learning-objects.testdata'; | ||||
| 
 | ||||
| describe('AnswerRepository', () => { | ||||
|     let answerRepository: AnswerRepository; | ||||
|  | @ -24,7 +19,7 @@ describe('AnswerRepository', () => { | |||
|         const a1 = getAnswer01(); | ||||
|         const a2 = getAnswer02(); | ||||
| 
 | ||||
|         const answers = await answerRepository.findAllAnswersToQuestion(question!); | ||||
|         const answers = await answerRepository.findAllAnswersToQuestion(question); | ||||
| 
 | ||||
|         expect(answers).toBeTruthy(); | ||||
|         expect(answers).toHaveLength(2); | ||||
|  | @ -38,7 +33,7 @@ describe('AnswerRepository', () => { | |||
| 
 | ||||
|         await answerRepository.createAnswer({ | ||||
|             toQuestion: question, | ||||
|             author: teacher!, | ||||
|             author: teacher, | ||||
|             content: 'created answer', | ||||
|         }); | ||||
| 
 | ||||
|  |  | |||
|  | @ -48,8 +48,8 @@ describe('QuestionRepository', () => { | |||
|         const group = getTestGroup01(); | ||||
|         await questionRepository.createQuestion({ | ||||
|             loId: id, | ||||
|             inGroup: group!, | ||||
|             author: student!, | ||||
|             inGroup: group, | ||||
|             author: student, | ||||
|             content: 'question?', | ||||
|         }); | ||||
|         const question = await questionRepository.findAllQuestionsAboutLearningObject(id); | ||||
|  | @ -66,7 +66,7 @@ describe('QuestionRepository', () => { | |||
|             language: testLearningObject05.language, | ||||
|             version: testLearningObject05.version, | ||||
|         }; | ||||
|         const result = await questionRepository.findAllQuestionsAboutLearningObjectInAssignment(loId, assignment!); | ||||
|         const result = await questionRepository.findAllQuestionsAboutLearningObjectInAssignment(loId, assignment); | ||||
|         sortQuestions(result); | ||||
| 
 | ||||
|         expect(result).toHaveLength(3); | ||||
|  | @ -94,7 +94,7 @@ describe('QuestionRepository', () => { | |||
|         }; | ||||
|         const assignment = getAssignment01(); | ||||
| 
 | ||||
|         const result = await questionRepository.findAllQuestionsAboutLearningObjectInAssignment(loId, assignment!, getTool().username); | ||||
|         const result = await questionRepository.findAllQuestionsAboutLearningObjectInAssignment(loId, assignment, getTool().username); | ||||
|         // (student Tool is in group #2)
 | ||||
| 
 | ||||
|         expect(result).toHaveLength(1); | ||||
|  |  | |||
|  | @ -2,7 +2,6 @@ import { setupTestApp } from '../../setup-tests.js'; | |||
| import { describe, it, expect, beforeAll } from 'vitest'; | ||||
| import { StudentRepository } from '../../../src/data/users/student-repository.js'; | ||||
| import { getStudentRepository } from '../../../src/data/repositories.js'; | ||||
| import { getNameOfJSDocTypedef } from 'typescript'; | ||||
| import { getNoordkaap } from '../../test_assets/users/students.testdata.js'; | ||||
| 
 | ||||
| const username = 'teststudent'; | ||||
|  |  | |||
		Reference in a new issue
	
	 laurejablonski
						laurejablonski