test: alle testen slagen na aanpassen testdata
This commit is contained in:
parent
1ff6405066
commit
a5e82858ab
8 changed files with 23 additions and 23 deletions
|
@ -186,7 +186,7 @@ describe('Student controllers', () => {
|
|||
|
||||
it('Get join request by student and class', async () => {
|
||||
req = {
|
||||
params: { username: 'PinkFloyd', classId: 'id02' },
|
||||
params: { username: 'PinkFloyd', classId: '34d484a1-295f-4e9f-bfdc-3e7a23d86a89' },
|
||||
};
|
||||
|
||||
await getStudentRequestHandler(req as Request, res as Response);
|
||||
|
@ -201,7 +201,7 @@ describe('Student controllers', () => {
|
|||
it('Create join request', async () => {
|
||||
req = {
|
||||
params: { username: 'Noordkaap' },
|
||||
body: { classId: 'id02' },
|
||||
body: { classId: '34d484a1-295f-4e9f-bfdc-3e7a23d86a89' },
|
||||
};
|
||||
|
||||
await createStudentRequestHandler(req as Request, res as Response);
|
||||
|
@ -212,7 +212,7 @@ describe('Student controllers', () => {
|
|||
it('Create join request duplicate', async () => {
|
||||
req = {
|
||||
params: { username: 'Tool' },
|
||||
body: { classId: 'id02' },
|
||||
body: { classId: '34d484a1-295f-4e9f-bfdc-3e7a23d86a89' },
|
||||
};
|
||||
|
||||
await expect(async () => createStudentRequestHandler(req as Request, res as Response)).rejects.toThrow(ConflictException);
|
||||
|
@ -220,7 +220,7 @@ describe('Student controllers', () => {
|
|||
|
||||
it('Delete join request', async () => {
|
||||
req = {
|
||||
params: { username: 'Noordkaap', classId: 'id02' },
|
||||
params: { username: 'Noordkaap', classId: '34d484a1-295f-4e9f-bfdc-3e7a23d86a89' },
|
||||
};
|
||||
|
||||
await deleteClassJoinRequestHandler(req as Request, res as Response);
|
||||
|
|
|
@ -104,9 +104,9 @@ describe('Teacher controllers', () => {
|
|||
const result = jsonMock.mock.lastCall?.[0];
|
||||
|
||||
const teacherUsernames = result.teachers.map((s: TeacherDTO) => s.username);
|
||||
expect(teacherUsernames).toContain('FooFighters');
|
||||
expect(teacherUsernames).toContain('testleerkracht1');
|
||||
|
||||
expect(result.teachers).toHaveLength(4);
|
||||
expect(result.teachers).toHaveLength(5);
|
||||
});
|
||||
|
||||
it('Deleting non-existent student', async () => {
|
||||
|
@ -117,7 +117,7 @@ describe('Teacher controllers', () => {
|
|||
|
||||
it('Get teacher classes', async () => {
|
||||
req = {
|
||||
params: { username: 'FooFighters' },
|
||||
params: { username: 'testleerkracht1' },
|
||||
query: { full: 'true' },
|
||||
};
|
||||
|
||||
|
@ -132,7 +132,7 @@ describe('Teacher controllers', () => {
|
|||
|
||||
it('Get teacher students', async () => {
|
||||
req = {
|
||||
params: { username: 'FooFighters' },
|
||||
params: { username: 'testleerkracht1' },
|
||||
query: { full: 'true' },
|
||||
};
|
||||
|
||||
|
@ -169,7 +169,7 @@ describe('Teacher controllers', () => {
|
|||
it('Get join requests by class', async () => {
|
||||
req = {
|
||||
query: { username: 'LimpBizkit' },
|
||||
params: { classId: 'id02' },
|
||||
params: { classId: '34d484a1-295f-4e9f-bfdc-3e7a23d86a89' },
|
||||
};
|
||||
|
||||
await getStudentJoinRequestHandler(req as Request, res as Response);
|
||||
|
@ -184,7 +184,7 @@ describe('Teacher controllers', () => {
|
|||
it('Update join request status', async () => {
|
||||
req = {
|
||||
query: { username: 'LimpBizkit', studentUsername: 'PinkFloyd' },
|
||||
params: { classId: 'id02' },
|
||||
params: { classId: '34d484a1-295f-4e9f-bfdc-3e7a23d86a89' },
|
||||
body: { accepted: 'true' },
|
||||
};
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ describe('AssignmentRepository', () => {
|
|||
});
|
||||
|
||||
it('should return the requested assignment', async () => {
|
||||
const class_ = await classRepository.findById('id02');
|
||||
const class_ = await classRepository.findById('34d484a1-295f-4e9f-bfdc-3e7a23d86a89');
|
||||
const assignment = await assignmentRepository.findByClassAndId(class_!, 2);
|
||||
|
||||
expect(assignment).toBeTruthy();
|
||||
|
@ -23,7 +23,7 @@ describe('AssignmentRepository', () => {
|
|||
});
|
||||
|
||||
it('should return all assignments for a class', async () => {
|
||||
const class_ = await classRepository.findById('id02');
|
||||
const class_ = await classRepository.findById('34d484a1-295f-4e9f-bfdc-3e7a23d86a89');
|
||||
const assignments = await assignmentRepository.findAllAssignmentsInClass(class_!);
|
||||
|
||||
expect(assignments).toBeTruthy();
|
||||
|
|
|
@ -18,7 +18,7 @@ describe('GroupRepository', () => {
|
|||
});
|
||||
|
||||
it('should return the requested group', async () => {
|
||||
const class_ = await classRepository.findById('id01');
|
||||
const class_ = await classRepository.findById('8764b861-90a6-42e5-9732-c0d9eb2f55f9');
|
||||
const assignment = await assignmentRepository.findByClassAndId(class_!, 1);
|
||||
|
||||
const group = await groupRepository.findByAssignmentAndGroupNumber(assignment!, 1);
|
||||
|
@ -27,7 +27,7 @@ describe('GroupRepository', () => {
|
|||
});
|
||||
|
||||
it('should return all groups for assignment', async () => {
|
||||
const class_ = await classRepository.findById('id01');
|
||||
const class_ = await classRepository.findById('8764b861-90a6-42e5-9732-c0d9eb2f55f9');
|
||||
const assignment = await assignmentRepository.findByClassAndId(class_!, 1);
|
||||
|
||||
const groups = await groupRepository.findAllGroupsForAssignment(assignment!);
|
||||
|
@ -37,7 +37,7 @@ describe('GroupRepository', () => {
|
|||
});
|
||||
|
||||
it('should not find removed group', async () => {
|
||||
const class_ = await classRepository.findById('id02');
|
||||
const class_ = await classRepository.findById('34d484a1-295f-4e9f-bfdc-3e7a23d86a89');
|
||||
const assignment = await assignmentRepository.findByClassAndId(class_!, 2);
|
||||
|
||||
await groupRepository.deleteByAssignmentAndGroupNumber(assignment!, 1);
|
||||
|
|
|
@ -50,7 +50,7 @@ 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 class_ = await classRepository.findById('8764b861-90a6-42e5-9732-c0d9eb2f55f9');
|
||||
const assignment = await assignmentRepository.findByClassAndId(class_!, 1);
|
||||
const group = await groupRepository.findByAssignmentAndGroupNumber(assignment!, 1);
|
||||
const submission = await submissionRepository.findMostRecentSubmissionForGroup(id, group!);
|
||||
|
|
|
@ -26,7 +26,7 @@ describe('ClassJoinRequestRepository', () => {
|
|||
});
|
||||
|
||||
it('should list all requests to a single class', async () => {
|
||||
const class_ = await cassRepository.findById('id02');
|
||||
const class_ = await cassRepository.findById('34d484a1-295f-4e9f-bfdc-3e7a23d86a89');
|
||||
const requests = await classJoinRequestRepository.findAllOpenRequestsTo(class_!);
|
||||
|
||||
expect(requests).toBeTruthy();
|
||||
|
@ -35,7 +35,7 @@ describe('ClassJoinRequestRepository', () => {
|
|||
|
||||
it('should not find a removed request', async () => {
|
||||
const student = await studentRepository.findByUsername('SmashingPumpkins');
|
||||
const class_ = await cassRepository.findById('id03');
|
||||
const class_ = await cassRepository.findById('80dcc3e0-1811-4091-9361-42c0eee91cfa');
|
||||
await classJoinRequestRepository.deleteBy(student!, class_!);
|
||||
|
||||
const request = await classJoinRequestRepository.findAllRequestsBy(student!);
|
||||
|
|
|
@ -18,16 +18,16 @@ describe('ClassRepository', () => {
|
|||
});
|
||||
|
||||
it('should return requested class', async () => {
|
||||
const classVar = await classRepository.findById('id01');
|
||||
const classVar = await classRepository.findById('8764b861-90a6-42e5-9732-c0d9eb2f55f9');
|
||||
|
||||
expect(classVar).toBeTruthy();
|
||||
expect(classVar?.displayName).toBe('class01');
|
||||
});
|
||||
|
||||
it('class should be gone after deletion', async () => {
|
||||
await classRepository.deleteById('id04');
|
||||
await classRepository.deleteById('33d03536-83b8-4880-9982-9bbf2f908ddf');
|
||||
|
||||
const classVar = await classRepository.findById('id04');
|
||||
const classVar = await classRepository.findById('33d03536-83b8-4880-9982-9bbf2f908ddf');
|
||||
|
||||
expect(classVar).toBeNull();
|
||||
});
|
||||
|
|
|
@ -34,7 +34,7 @@ describe('ClassRepository', () => {
|
|||
});
|
||||
|
||||
it('should return all invitations for a class', async () => {
|
||||
const class_ = await classRepository.findById('id02');
|
||||
const class_ = await classRepository.findById('34d484a1-295f-4e9f-bfdc-3e7a23d86a89');
|
||||
const invitations = await teacherInvitationRepository.findAllInvitationsForClass(class_!);
|
||||
|
||||
expect(invitations).toBeTruthy();
|
||||
|
@ -42,7 +42,7 @@ describe('ClassRepository', () => {
|
|||
});
|
||||
|
||||
it('should not find a removed invitation', async () => {
|
||||
const class_ = await classRepository.findById('id01');
|
||||
const class_ = await classRepository.findById('8764b861-90a6-42e5-9732-c0d9eb2f55f9');
|
||||
const sender = await teacherRepository.findByUsername('FooFighters');
|
||||
const receiver = await teacherRepository.findByUsername('LimpBizkit');
|
||||
await teacherInvitationRepository.deleteBy(class_!, sender!, receiver!);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue