From 1b18338c786d582b6021bbb1dffb886496ea1cec Mon Sep 17 00:00:00 2001 From: Lint Action Date: Tue, 13 May 2025 07:48:17 +0000 Subject: [PATCH] style: fix linting issues met ESLint --- backend/tests/data/assignments/assignments.test.ts | 4 ++-- backend/tests/data/assignments/groups.test.ts | 8 ++++---- backend/tests/data/assignments/submissions.test.ts | 6 +++--- backend/tests/data/classes/class-join-request.test.ts | 6 +++--- backend/tests/data/classes/teacher-invitation.test.ts | 10 +++++----- .../data/content/learning-object-repository.test.ts | 8 ++++---- backend/tests/data/questions/answers.test.ts | 4 ++-- backend/tests/data/questions/questions.test.ts | 8 ++++---- .../tests/test_assets/assignments/groups.testdata.ts | 2 +- .../test_assets/assignments/submission.testdata.ts | 2 +- backend/tests/test_assets/classes/classes.testdata.ts | 2 +- .../classes/teacher-invitations.testdata.ts | 2 +- .../tests/test_assets/content/attachments.testdata.ts | 2 +- .../tests/test_assets/questions/answers.testdata.ts | 2 +- .../tests/test_assets/questions/questions.testdata.ts | 2 +- 15 files changed, 34 insertions(+), 34 deletions(-) diff --git a/backend/tests/data/assignments/assignments.test.ts b/backend/tests/data/assignments/assignments.test.ts index 2ab477fb..df62b4a4 100644 --- a/backend/tests/data/assignments/assignments.test.ts +++ b/backend/tests/data/assignments/assignments.test.ts @@ -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); diff --git a/backend/tests/data/assignments/groups.test.ts b/backend/tests/data/assignments/groups.test.ts index 4f4c9ee1..b876981c 100644 --- a/backend/tests/data/assignments/groups.test.ts +++ b/backend/tests/data/assignments/groups.test.ts @@ -21,7 +21,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 +36,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 +49,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(); }); diff --git a/backend/tests/data/assignments/submissions.test.ts b/backend/tests/data/assignments/submissions.test.ts index b98f4900..c464bdf2 100644 --- a/backend/tests/data/assignments/submissions.test.ts +++ b/backend/tests/data/assignments/submissions.test.ts @@ -42,7 +42,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 +67,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 +94,7 @@ describe('SubmissionRepository', () => { version: usedSubmission.learningObjectVersion, }; - const result = await submissionRepository.findAllSubmissionsForLearningObjectAndGroup(loId, group!); + const result = await submissionRepository.findAllSubmissionsForLearningObjectAndGroup(loId, group); expect(result).toHaveLength(1); diff --git a/backend/tests/data/classes/class-join-request.test.ts b/backend/tests/data/classes/class-join-request.test.ts index 7e3aa8e5..f77dcd26 100644 --- a/backend/tests/data/classes/class-join-request.test.ts +++ b/backend/tests/data/classes/class-join-request.test.ts @@ -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); }); diff --git a/backend/tests/data/classes/teacher-invitation.test.ts b/backend/tests/data/classes/teacher-invitation.test.ts index f3d125cc..64e815de 100644 --- a/backend/tests/data/classes/teacher-invitation.test.ts +++ b/backend/tests/data/classes/teacher-invitation.test.ts @@ -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); }); diff --git a/backend/tests/data/content/learning-object-repository.test.ts b/backend/tests/data/content/learning-object-repository.test.ts index c534343a..b80ca681 100644 --- a/backend/tests/data/content/learning-object-repository.test.ts +++ b/backend/tests/data/content/learning-object-repository.test.ts @@ -38,7 +38,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)'; @@ -52,9 +52,9 @@ describe('LearningObjectRepository', () => { const result = await learningObjectRepository.findLatestByHruidAndLanguage(newerExample.hruid, newerExample.language); - // expect(result).toBeInstanceOf(LearningObject); - // expect(result?.version).toBe(10); - // expect(result?.title).toContain('(nieuw)'); + // 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 () => { diff --git a/backend/tests/data/questions/answers.test.ts b/backend/tests/data/questions/answers.test.ts index b69765be..456323fd 100644 --- a/backend/tests/data/questions/answers.test.ts +++ b/backend/tests/data/questions/answers.test.ts @@ -24,7 +24,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 +38,7 @@ describe('AnswerRepository', () => { await answerRepository.createAnswer({ toQuestion: question, - author: teacher!, + author: teacher, content: 'created answer', }); diff --git a/backend/tests/data/questions/questions.test.ts b/backend/tests/data/questions/questions.test.ts index b3392860..1e52b743 100644 --- a/backend/tests/data/questions/questions.test.ts +++ b/backend/tests/data/questions/questions.test.ts @@ -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); diff --git a/backend/tests/test_assets/assignments/groups.testdata.ts b/backend/tests/test_assets/assignments/groups.testdata.ts index c177ee78..f2508108 100644 --- a/backend/tests/test_assets/assignments/groups.testdata.ts +++ b/backend/tests/test_assets/assignments/groups.testdata.ts @@ -8,7 +8,7 @@ export function makeTestGroups(em: EntityManager): Group[] { * Group #1 for Assignment #1 in class 'id01' * => Assigned to do learning path 'id02' */ - // gets deleted + // Gets deleted group01 = em.create(Group, { assignment: getAssignment01(), groupNumber: 21001, diff --git a/backend/tests/test_assets/assignments/submission.testdata.ts b/backend/tests/test_assets/assignments/submission.testdata.ts index 96d02c55..ff5da170 100644 --- a/backend/tests/test_assets/assignments/submission.testdata.ts +++ b/backend/tests/test_assets/assignments/submission.testdata.ts @@ -71,7 +71,7 @@ export function makeTestSubmissions(em: EntityManager): Submission[] { content: '', }); - // gets deleted + // Gets deleted submission07 = em.create(Submission, { learningObjectHruid: testLearningObject01.hruid, learningObjectLanguage: testLearningObject01.language, diff --git a/backend/tests/test_assets/classes/classes.testdata.ts b/backend/tests/test_assets/classes/classes.testdata.ts index 2cfa8603..29a3ae80 100644 --- a/backend/tests/test_assets/classes/classes.testdata.ts +++ b/backend/tests/test_assets/classes/classes.testdata.ts @@ -39,7 +39,7 @@ export function makeTestClasses(em: EntityManager): Class[] { const studentsClass04: Student[] = [getNoordkaap(), getDireStraits()]; const teacherClass04: Teacher[] = [getStaind()]; - // gets deleted in test + // Gets deleted in test class04 = em.create(Class, { classId: 'Q8N5YC', // 33d03536-83b8-4880-9982-9bbf2f908ddf displayName: 'class04', diff --git a/backend/tests/test_assets/classes/teacher-invitations.testdata.ts b/backend/tests/test_assets/classes/teacher-invitations.testdata.ts index c3d78eb4..df260cf3 100644 --- a/backend/tests/test_assets/classes/teacher-invitations.testdata.ts +++ b/backend/tests/test_assets/classes/teacher-invitations.testdata.ts @@ -26,7 +26,7 @@ export function makeTestTeacherInvitations(em: EntityManager): TeacherInvitation status: ClassStatus.Open, }); - // gets deleted in test + // Gets deleted in test teacherInvitation04 = em.create(TeacherInvitation, { sender: getFooFighters(), receiver: getLimpBizkit(), diff --git a/backend/tests/test_assets/content/attachments.testdata.ts b/backend/tests/test_assets/content/attachments.testdata.ts index 1f1bc042..8c31833a 100644 --- a/backend/tests/test_assets/content/attachments.testdata.ts +++ b/backend/tests/test_assets/content/attachments.testdata.ts @@ -4,7 +4,7 @@ import { testLearningObject01 } from './learning-objects.testdata'; import { LearningObject } from '../../../src/entities/content/learning-object.entity'; export function makeTestAttachments(em: EntityManager): Attachment[] { - // prevent duplicate insertion + // Prevent duplicate insertion const lo = em.merge(LearningObject, testLearningObject01); attachment01 = em.create(Attachment, { diff --git a/backend/tests/test_assets/questions/answers.testdata.ts b/backend/tests/test_assets/questions/answers.testdata.ts index 904ba338..1ff3a669 100644 --- a/backend/tests/test_assets/questions/answers.testdata.ts +++ b/backend/tests/test_assets/questions/answers.testdata.ts @@ -20,7 +20,7 @@ export function makeTestAnswers(em: EntityManager): Answer[] { content: 'answer2', }); - // gets deleted + // Gets deleted answer03 = em.create(Answer, { author: getLimpBizkit(), toQuestion: getQuestion04(), diff --git a/backend/tests/test_assets/questions/questions.testdata.ts b/backend/tests/test_assets/questions/questions.testdata.ts index b9339274..7a99af38 100644 --- a/backend/tests/test_assets/questions/questions.testdata.ts +++ b/backend/tests/test_assets/questions/questions.testdata.ts @@ -27,7 +27,7 @@ export function makeTestQuestions(em: EntityManager): Question[] { content: 'question', }); - //gets deleted + //Gets deleted question03 = em.create(Question, { learningObjectLanguage: testLearningObject04.language, learningObjectVersion: testLearningObject04.version,