style: fix linting issues met Prettier
This commit is contained in:
parent
e58835aa17
commit
e73d5c21c3
34 changed files with 103 additions and 296 deletions
|
@ -1,10 +1,7 @@
|
|||
import { beforeAll, describe, expect, it } from 'vitest';
|
||||
import { setupTestApp } from '../../setup-tests';
|
||||
import { AssignmentRepository } from '../../../src/data/assignments/assignment-repository';
|
||||
import {
|
||||
getAssignmentRepository,
|
||||
getClassRepository,
|
||||
} from '../../../src/data/repositories';
|
||||
import { getAssignmentRepository, getClassRepository } from '../../../src/data/repositories';
|
||||
import { ClassRepository } from '../../../src/data/classes/class-repository';
|
||||
|
||||
describe('AssignmentRepository', () => {
|
||||
|
@ -19,10 +16,7 @@ describe('AssignmentRepository', () => {
|
|||
|
||||
it('should return the requested assignment', async () => {
|
||||
const class_ = await classRepository.findById('id02');
|
||||
const assignment = await assignmentRepository.findByClassAndId(
|
||||
class_!,
|
||||
2
|
||||
);
|
||||
const assignment = await assignmentRepository.findByClassAndId(class_!, 2);
|
||||
|
||||
expect(assignment).toBeTruthy();
|
||||
expect(assignment!.title).toBe('tool');
|
||||
|
@ -30,8 +24,7 @@ describe('AssignmentRepository', () => {
|
|||
|
||||
it('should return all assignments for a class', async () => {
|
||||
const class_ = await classRepository.findById('id02');
|
||||
const assignments =
|
||||
await assignmentRepository.findAllAssignmentsInClass(class_!);
|
||||
const assignments = await assignmentRepository.findAllAssignmentsInClass(class_!);
|
||||
|
||||
expect(assignments).toBeTruthy();
|
||||
expect(assignments).toHaveLength(1);
|
||||
|
@ -42,10 +35,7 @@ describe('AssignmentRepository', () => {
|
|||
const class_ = await classRepository.findById('id01');
|
||||
await assignmentRepository.deleteByClassAndId(class_!, 3);
|
||||
|
||||
const assignment = await assignmentRepository.findByClassAndId(
|
||||
class_!,
|
||||
3
|
||||
);
|
||||
const assignment = await assignmentRepository.findByClassAndId(class_!, 3);
|
||||
|
||||
expect(assignment).toBeNull();
|
||||
});
|
||||
|
|
|
@ -1,11 +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 { getAssignmentRepository, getClassRepository, getGroupRepository } from '../../../src/data/repositories';
|
||||
import { AssignmentRepository } from '../../../src/data/assignments/assignment-repository';
|
||||
import { ClassRepository } from '../../../src/data/classes/class-repository';
|
||||
|
||||
|
@ -23,29 +19,18 @@ describe('GroupRepository', () => {
|
|||
|
||||
it('should return the requested group', async () => {
|
||||
const class_ = await classRepository.findById('id01');
|
||||
const assignment = await assignmentRepository.findByClassAndId(
|
||||
class_!,
|
||||
1
|
||||
);
|
||||
const assignment = await assignmentRepository.findByClassAndId(class_!, 1);
|
||||
|
||||
const group = await groupRepository.findByAssignmentAndGroupNumber(
|
||||
assignment!,
|
||||
1
|
||||
);
|
||||
const group = await groupRepository.findByAssignmentAndGroupNumber(assignment!, 1);
|
||||
|
||||
expect(group).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should return all groups for assignment', async () => {
|
||||
const class_ = await classRepository.findById('id01');
|
||||
const assignment = await assignmentRepository.findByClassAndId(
|
||||
class_!,
|
||||
1
|
||||
);
|
||||
const assignment = await assignmentRepository.findByClassAndId(class_!, 1);
|
||||
|
||||
const groups = await groupRepository.findAllGroupsForAssignment(
|
||||
assignment!
|
||||
);
|
||||
const groups = await groupRepository.findAllGroupsForAssignment(assignment!);
|
||||
|
||||
expect(groups).toBeTruthy();
|
||||
expect(groups).toHaveLength(3);
|
||||
|
@ -53,17 +38,11 @@ describe('GroupRepository', () => {
|
|||
|
||||
it('should not find removed group', async () => {
|
||||
const class_ = await classRepository.findById('id02');
|
||||
const assignment = await assignmentRepository.findByClassAndId(
|
||||
class_!,
|
||||
2
|
||||
);
|
||||
const assignment = await assignmentRepository.findByClassAndId(class_!, 2);
|
||||
|
||||
await groupRepository.deleteByAssignmentAndGroupNumber(assignment!, 1);
|
||||
|
||||
const group = await groupRepository.findByAssignmentAndGroupNumber(
|
||||
assignment!,
|
||||
1
|
||||
);
|
||||
const group = await groupRepository.findByAssignmentAndGroupNumber(assignment!, 1);
|
||||
|
||||
expect(group).toBeNull();
|
||||
});
|
||||
|
|
|
@ -33,11 +33,7 @@ describe('SubmissionRepository', () => {
|
|||
|
||||
it('should find the requested submission', async () => {
|
||||
const id = new LearningObjectIdentifier('id03', Language.English, '1');
|
||||
const submission =
|
||||
await submissionRepository.findSubmissionByLearningObjectAndSubmissionNumber(
|
||||
id,
|
||||
1
|
||||
);
|
||||
const submission = await submissionRepository.findSubmissionByLearningObjectAndSubmissionNumber(id, 1);
|
||||
|
||||
expect(submission).toBeTruthy();
|
||||
expect(submission?.content).toBe('sub1');
|
||||
|
@ -46,11 +42,7 @@ describe('SubmissionRepository', () => {
|
|||
it('should find the most recent submission for a student', async () => {
|
||||
const id = new LearningObjectIdentifier('id02', Language.English, '1');
|
||||
const student = await studentRepository.findByUsername('Noordkaap');
|
||||
const submission =
|
||||
await submissionRepository.findMostRecentSubmissionForStudent(
|
||||
id,
|
||||
student!
|
||||
);
|
||||
const submission = await submissionRepository.findMostRecentSubmissionForStudent(id, student!);
|
||||
|
||||
expect(submission).toBeTruthy();
|
||||
expect(submission?.submissionTime.getDate()).toBe(25);
|
||||
|
@ -59,19 +51,9 @@ describe('SubmissionRepository', () => {
|
|||
it('should find the most recent submission for a group', async () => {
|
||||
const id = new LearningObjectIdentifier('id03', Language.English, '1');
|
||||
const class_ = await classRepository.findById('id01');
|
||||
const assignment = await assignmentRepository.findByClassAndId(
|
||||
class_!,
|
||||
1
|
||||
);
|
||||
const group = await groupRepository.findByAssignmentAndGroupNumber(
|
||||
assignment!,
|
||||
1
|
||||
);
|
||||
const submission =
|
||||
await submissionRepository.findMostRecentSubmissionForGroup(
|
||||
id,
|
||||
group!
|
||||
);
|
||||
const assignment = await assignmentRepository.findByClassAndId(class_!, 1);
|
||||
const group = await groupRepository.findByAssignmentAndGroupNumber(assignment!, 1);
|
||||
const submission = await submissionRepository.findMostRecentSubmissionForGroup(id, group!);
|
||||
|
||||
expect(submission).toBeTruthy();
|
||||
expect(submission?.submissionTime.getDate()).toBe(25);
|
||||
|
@ -79,16 +61,9 @@ describe('SubmissionRepository', () => {
|
|||
|
||||
it('should not find a deleted submission', async () => {
|
||||
const id = new LearningObjectIdentifier('id01', Language.English, '1');
|
||||
await submissionRepository.deleteSubmissionByLearningObjectAndSubmissionNumber(
|
||||
id,
|
||||
1
|
||||
);
|
||||
await submissionRepository.deleteSubmissionByLearningObjectAndSubmissionNumber(id, 1);
|
||||
|
||||
const submission =
|
||||
await submissionRepository.findSubmissionByLearningObjectAndSubmissionNumber(
|
||||
id,
|
||||
1
|
||||
);
|
||||
const submission = await submissionRepository.findSubmissionByLearningObjectAndSubmissionNumber(id, 1);
|
||||
|
||||
expect(submission).toBeNull();
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue