style: fix linting issues met ESLint
This commit is contained in:
parent
47e47323d3
commit
1b18338c78
15 changed files with 34 additions and 34 deletions
|
@ -17,7 +17,7 @@ describe('AssignmentRepository', () => {
|
||||||
it('should return the requested assignment', async () => {
|
it('should return the requested assignment', async () => {
|
||||||
const class_ = getClass02();
|
const class_ = getClass02();
|
||||||
const usedAssignment = getAssignment02();
|
const usedAssignment = getAssignment02();
|
||||||
const assignment = await assignmentRepository.findByClassAndId(class_!, 21001);
|
const assignment = await assignmentRepository.findByClassAndId(class_, 21001);
|
||||||
|
|
||||||
expect(assignment).toBeTruthy();
|
expect(assignment).toBeTruthy();
|
||||||
expect(assignment!.description).toBe(usedAssignment.description);
|
expect(assignment!.description).toBe(usedAssignment.description);
|
||||||
|
@ -30,7 +30,7 @@ describe('AssignmentRepository', () => {
|
||||||
it('should return all assignments for a class', async () => {
|
it('should return all assignments for a class', async () => {
|
||||||
const class_ = getClass02();
|
const class_ = getClass02();
|
||||||
const usedAssignment = getAssignment02();
|
const usedAssignment = getAssignment02();
|
||||||
const assignments = await assignmentRepository.findAllAssignmentsInClass(class_!);
|
const assignments = await assignmentRepository.findAllAssignmentsInClass(class_);
|
||||||
|
|
||||||
expect(assignments).toBeTruthy();
|
expect(assignments).toBeTruthy();
|
||||||
expect(assignments).toHaveLength(1);
|
expect(assignments).toHaveLength(1);
|
||||||
|
|
|
@ -21,7 +21,7 @@ describe('GroupRepository', () => {
|
||||||
const member1 = getNoordkaap();
|
const member1 = getNoordkaap();
|
||||||
const member2 = getDireStraits();
|
const member2 = getDireStraits();
|
||||||
|
|
||||||
const group = await groupRepository.findByAssignmentAndGroupNumber(assignment!, usedGroup.groupNumber!);
|
const group = await groupRepository.findByAssignmentAndGroupNumber(assignment, usedGroup.groupNumber!);
|
||||||
|
|
||||||
expect(group).toBeTruthy();
|
expect(group).toBeTruthy();
|
||||||
expect(group?.groupNumber).toBe(usedGroup.groupNumber);
|
expect(group?.groupNumber).toBe(usedGroup.groupNumber);
|
||||||
|
@ -36,7 +36,7 @@ describe('GroupRepository', () => {
|
||||||
const gr2 = getTestGroup02();
|
const gr2 = getTestGroup02();
|
||||||
const gr3 = getTestGroup03();
|
const gr3 = getTestGroup03();
|
||||||
|
|
||||||
const groups = await groupRepository.findAllGroupsForAssignment(assignment!);
|
const groups = await groupRepository.findAllGroupsForAssignment(assignment);
|
||||||
|
|
||||||
expect(groups).toBeTruthy();
|
expect(groups).toBeTruthy();
|
||||||
expect(groups).toHaveLength(3);
|
expect(groups).toHaveLength(3);
|
||||||
|
@ -49,9 +49,9 @@ describe('GroupRepository', () => {
|
||||||
const assignment = getAssignment02();
|
const assignment = getAssignment02();
|
||||||
const deleted = getTestGroup01();
|
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();
|
expect(group).toBeNull();
|
||||||
});
|
});
|
||||||
|
|
|
@ -42,7 +42,7 @@ describe('SubmissionRepository', () => {
|
||||||
const usedSubmission = getSubmission02();
|
const usedSubmission = getSubmission02();
|
||||||
const id = new LearningObjectIdentifier(usedSubmission.learningObjectHruid, usedSubmission.learningObjectLanguage, usedSubmission.learningObjectVersion);
|
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).toBeTruthy();
|
||||||
expect(submission?.submissionTime).toStrictEqual(usedSubmission.submissionTime);
|
expect(submission?.submissionTime).toStrictEqual(usedSubmission.submissionTime);
|
||||||
|
@ -67,7 +67,7 @@ describe('SubmissionRepository', () => {
|
||||||
language: usedSubmission.learningObjectLanguage,
|
language: usedSubmission.learningObjectLanguage,
|
||||||
version: usedSubmission.learningObjectVersion,
|
version: usedSubmission.learningObjectVersion,
|
||||||
};
|
};
|
||||||
const result = await submissionRepository.findAllSubmissionsForLearningObjectAndAssignment(loId, assignment!);
|
const result = await submissionRepository.findAllSubmissionsForLearningObjectAndAssignment(loId, assignment);
|
||||||
sortSubmissions(result);
|
sortSubmissions(result);
|
||||||
|
|
||||||
expect(result).toHaveLength(3);
|
expect(result).toHaveLength(3);
|
||||||
|
@ -94,7 +94,7 @@ describe('SubmissionRepository', () => {
|
||||||
version: usedSubmission.learningObjectVersion,
|
version: usedSubmission.learningObjectVersion,
|
||||||
};
|
};
|
||||||
|
|
||||||
const result = await submissionRepository.findAllSubmissionsForLearningObjectAndGroup(loId, group!);
|
const result = await submissionRepository.findAllSubmissionsForLearningObjectAndGroup(loId, group);
|
||||||
|
|
||||||
expect(result).toHaveLength(1);
|
expect(result).toHaveLength(1);
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ describe('ClassJoinRequestRepository', () => {
|
||||||
const class_ = getClass02();
|
const class_ = getClass02();
|
||||||
const jr1 = getClassJoinRequest01();
|
const jr1 = getClassJoinRequest01();
|
||||||
const jr2 = getClassJoinRequest02();
|
const jr2 = getClassJoinRequest02();
|
||||||
const requests = await classJoinRequestRepository.findAllOpenRequestsTo(class_!);
|
const requests = await classJoinRequestRepository.findAllOpenRequestsTo(class_);
|
||||||
|
|
||||||
expect(requests).toBeTruthy();
|
expect(requests).toBeTruthy();
|
||||||
expect(requests).toHaveLength(2);
|
expect(requests).toHaveLength(2);
|
||||||
|
@ -41,9 +41,9 @@ describe('ClassJoinRequestRepository', () => {
|
||||||
it('should not find a removed request', async () => {
|
it('should not find a removed request', async () => {
|
||||||
const studentUsed = getSmashingPumpkins();
|
const studentUsed = getSmashingPumpkins();
|
||||||
const class_ = getClass03();
|
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);
|
expect(request).toHaveLength(0);
|
||||||
});
|
});
|
||||||
|
|
|
@ -18,7 +18,7 @@ describe('ClassRepository', () => {
|
||||||
const teacher = getLimpBizkit();
|
const teacher = getLimpBizkit();
|
||||||
const ti1 = getTeacherInvitation01();
|
const ti1 = getTeacherInvitation01();
|
||||||
const ti2 = getTeacherInvitation02();
|
const ti2 = getTeacherInvitation02();
|
||||||
const invitations = await teacherInvitationRepository.findAllInvitationsBy(teacher!);
|
const invitations = await teacherInvitationRepository.findAllInvitationsBy(teacher);
|
||||||
|
|
||||||
expect(invitations).toBeTruthy();
|
expect(invitations).toBeTruthy();
|
||||||
expect(invitations).toHaveLength(2);
|
expect(invitations).toHaveLength(2);
|
||||||
|
@ -30,7 +30,7 @@ describe('ClassRepository', () => {
|
||||||
const teacher = getFooFighters();
|
const teacher = getFooFighters();
|
||||||
const ti1 = getTeacherInvitation01();
|
const ti1 = getTeacherInvitation01();
|
||||||
const ti2 = getTeacherInvitation03();
|
const ti2 = getTeacherInvitation03();
|
||||||
const invitations = await teacherInvitationRepository.findAllInvitationsFor(teacher!);
|
const invitations = await teacherInvitationRepository.findAllInvitationsFor(teacher);
|
||||||
|
|
||||||
expect(invitations).toBeTruthy();
|
expect(invitations).toBeTruthy();
|
||||||
expect(invitations).toHaveLength(2);
|
expect(invitations).toHaveLength(2);
|
||||||
|
@ -42,7 +42,7 @@ describe('ClassRepository', () => {
|
||||||
const class_ = getClass02();
|
const class_ = getClass02();
|
||||||
const ti1 = getTeacherInvitation01();
|
const ti1 = getTeacherInvitation01();
|
||||||
const ti2 = getTeacherInvitation02();
|
const ti2 = getTeacherInvitation02();
|
||||||
const invitations = await teacherInvitationRepository.findAllInvitationsForClass(class_!);
|
const invitations = await teacherInvitationRepository.findAllInvitationsForClass(class_);
|
||||||
|
|
||||||
expect(invitations).toBeTruthy();
|
expect(invitations).toBeTruthy();
|
||||||
expect(invitations).toHaveLength(2);
|
expect(invitations).toHaveLength(2);
|
||||||
|
@ -55,9 +55,9 @@ describe('ClassRepository', () => {
|
||||||
const class_ = getClass01();
|
const class_ = getClass01();
|
||||||
const sender = getFooFighters();
|
const sender = getFooFighters();
|
||||||
const receiver = getLimpBizkit();
|
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);
|
expect(invitation).toHaveLength(0);
|
||||||
});
|
});
|
||||||
|
|
|
@ -38,7 +38,7 @@ describe('LearningObjectRepository', () => {
|
||||||
let newerExample: LearningObject;
|
let newerExample: LearningObject;
|
||||||
|
|
||||||
it('should allow a learning object with the same id except a different version to be added', async () => {
|
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 };
|
const testLearningObject01Newer = { ...testLearningObject01 };
|
||||||
testLearningObject01Newer.version = 10;
|
testLearningObject01Newer.version = 10;
|
||||||
testLearningObject01Newer.title += ' (nieuw)';
|
testLearningObject01Newer.title += ' (nieuw)';
|
||||||
|
@ -52,9 +52,9 @@ describe('LearningObjectRepository', () => {
|
||||||
|
|
||||||
|
|
||||||
const result = await learningObjectRepository.findLatestByHruidAndLanguage(newerExample.hruid, newerExample.language);
|
const result = await learningObjectRepository.findLatestByHruidAndLanguage(newerExample.hruid, newerExample.language);
|
||||||
// expect(result).toBeInstanceOf(LearningObject);
|
// Expect(result).toBeInstanceOf(LearningObject);
|
||||||
// expect(result?.version).toBe(10);
|
// Expect(result?.version).toBe(10);
|
||||||
// expect(result?.title).toContain('(nieuw)');
|
// Expect(result?.title).toContain('(nieuw)');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return null when queried by non-existing hruid or language', async () => {
|
it('should return null when queried by non-existing hruid or language', async () => {
|
||||||
|
|
|
@ -24,7 +24,7 @@ describe('AnswerRepository', () => {
|
||||||
const a1 = getAnswer01();
|
const a1 = getAnswer01();
|
||||||
const a2 = getAnswer02();
|
const a2 = getAnswer02();
|
||||||
|
|
||||||
const answers = await answerRepository.findAllAnswersToQuestion(question!);
|
const answers = await answerRepository.findAllAnswersToQuestion(question);
|
||||||
|
|
||||||
expect(answers).toBeTruthy();
|
expect(answers).toBeTruthy();
|
||||||
expect(answers).toHaveLength(2);
|
expect(answers).toHaveLength(2);
|
||||||
|
@ -38,7 +38,7 @@ describe('AnswerRepository', () => {
|
||||||
|
|
||||||
await answerRepository.createAnswer({
|
await answerRepository.createAnswer({
|
||||||
toQuestion: question,
|
toQuestion: question,
|
||||||
author: teacher!,
|
author: teacher,
|
||||||
content: 'created answer',
|
content: 'created answer',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -48,8 +48,8 @@ describe('QuestionRepository', () => {
|
||||||
const group = getTestGroup01();
|
const group = getTestGroup01();
|
||||||
await questionRepository.createQuestion({
|
await questionRepository.createQuestion({
|
||||||
loId: id,
|
loId: id,
|
||||||
inGroup: group!,
|
inGroup: group,
|
||||||
author: student!,
|
author: student,
|
||||||
content: 'question?',
|
content: 'question?',
|
||||||
});
|
});
|
||||||
const question = await questionRepository.findAllQuestionsAboutLearningObject(id);
|
const question = await questionRepository.findAllQuestionsAboutLearningObject(id);
|
||||||
|
@ -66,7 +66,7 @@ describe('QuestionRepository', () => {
|
||||||
language: testLearningObject05.language,
|
language: testLearningObject05.language,
|
||||||
version: testLearningObject05.version,
|
version: testLearningObject05.version,
|
||||||
};
|
};
|
||||||
const result = await questionRepository.findAllQuestionsAboutLearningObjectInAssignment(loId, assignment!);
|
const result = await questionRepository.findAllQuestionsAboutLearningObjectInAssignment(loId, assignment);
|
||||||
sortQuestions(result);
|
sortQuestions(result);
|
||||||
|
|
||||||
expect(result).toHaveLength(3);
|
expect(result).toHaveLength(3);
|
||||||
|
@ -94,7 +94,7 @@ describe('QuestionRepository', () => {
|
||||||
};
|
};
|
||||||
const assignment = getAssignment01();
|
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)
|
// (student Tool is in group #2)
|
||||||
|
|
||||||
expect(result).toHaveLength(1);
|
expect(result).toHaveLength(1);
|
||||||
|
|
|
@ -8,7 +8,7 @@ export function makeTestGroups(em: EntityManager): Group[] {
|
||||||
* Group #1 for Assignment #1 in class 'id01'
|
* Group #1 for Assignment #1 in class 'id01'
|
||||||
* => Assigned to do learning path 'id02'
|
* => Assigned to do learning path 'id02'
|
||||||
*/
|
*/
|
||||||
// gets deleted
|
// Gets deleted
|
||||||
group01 = em.create(Group, {
|
group01 = em.create(Group, {
|
||||||
assignment: getAssignment01(),
|
assignment: getAssignment01(),
|
||||||
groupNumber: 21001,
|
groupNumber: 21001,
|
||||||
|
|
|
@ -71,7 +71,7 @@ export function makeTestSubmissions(em: EntityManager): Submission[] {
|
||||||
content: '',
|
content: '',
|
||||||
});
|
});
|
||||||
|
|
||||||
// gets deleted
|
// Gets deleted
|
||||||
submission07 = em.create(Submission, {
|
submission07 = em.create(Submission, {
|
||||||
learningObjectHruid: testLearningObject01.hruid,
|
learningObjectHruid: testLearningObject01.hruid,
|
||||||
learningObjectLanguage: testLearningObject01.language,
|
learningObjectLanguage: testLearningObject01.language,
|
||||||
|
|
|
@ -39,7 +39,7 @@ export function makeTestClasses(em: EntityManager): Class[] {
|
||||||
const studentsClass04: Student[] = [getNoordkaap(), getDireStraits()];
|
const studentsClass04: Student[] = [getNoordkaap(), getDireStraits()];
|
||||||
const teacherClass04: Teacher[] = [getStaind()];
|
const teacherClass04: Teacher[] = [getStaind()];
|
||||||
|
|
||||||
// gets deleted in test
|
// Gets deleted in test
|
||||||
class04 = em.create(Class, {
|
class04 = em.create(Class, {
|
||||||
classId: 'Q8N5YC', // 33d03536-83b8-4880-9982-9bbf2f908ddf
|
classId: 'Q8N5YC', // 33d03536-83b8-4880-9982-9bbf2f908ddf
|
||||||
displayName: 'class04',
|
displayName: 'class04',
|
||||||
|
|
|
@ -26,7 +26,7 @@ export function makeTestTeacherInvitations(em: EntityManager): TeacherInvitation
|
||||||
status: ClassStatus.Open,
|
status: ClassStatus.Open,
|
||||||
});
|
});
|
||||||
|
|
||||||
// gets deleted in test
|
// Gets deleted in test
|
||||||
teacherInvitation04 = em.create(TeacherInvitation, {
|
teacherInvitation04 = em.create(TeacherInvitation, {
|
||||||
sender: getFooFighters(),
|
sender: getFooFighters(),
|
||||||
receiver: getLimpBizkit(),
|
receiver: getLimpBizkit(),
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { testLearningObject01 } from './learning-objects.testdata';
|
||||||
import { LearningObject } from '../../../src/entities/content/learning-object.entity';
|
import { LearningObject } from '../../../src/entities/content/learning-object.entity';
|
||||||
|
|
||||||
export function makeTestAttachments(em: EntityManager): Attachment[] {
|
export function makeTestAttachments(em: EntityManager): Attachment[] {
|
||||||
// prevent duplicate insertion
|
// Prevent duplicate insertion
|
||||||
const lo = em.merge(LearningObject, testLearningObject01);
|
const lo = em.merge(LearningObject, testLearningObject01);
|
||||||
|
|
||||||
attachment01 = em.create(Attachment, {
|
attachment01 = em.create(Attachment, {
|
||||||
|
|
|
@ -20,7 +20,7 @@ export function makeTestAnswers(em: EntityManager): Answer[] {
|
||||||
content: 'answer2',
|
content: 'answer2',
|
||||||
});
|
});
|
||||||
|
|
||||||
// gets deleted
|
// Gets deleted
|
||||||
answer03 = em.create(Answer, {
|
answer03 = em.create(Answer, {
|
||||||
author: getLimpBizkit(),
|
author: getLimpBizkit(),
|
||||||
toQuestion: getQuestion04(),
|
toQuestion: getQuestion04(),
|
||||||
|
|
|
@ -27,7 +27,7 @@ export function makeTestQuestions(em: EntityManager): Question[] {
|
||||||
content: 'question',
|
content: 'question',
|
||||||
});
|
});
|
||||||
|
|
||||||
//gets deleted
|
//Gets deleted
|
||||||
question03 = em.create(Question, {
|
question03 = em.create(Question, {
|
||||||
learningObjectLanguage: testLearningObject04.language,
|
learningObjectLanguage: testLearningObject04.language,
|
||||||
learningObjectVersion: testLearningObject04.version,
|
learningObjectVersion: testLearningObject04.version,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue