fix: gefaalde testen gefixt voor group controller
This commit is contained in:
parent
943dd04e97
commit
bede00df81
2 changed files with 7 additions and 3 deletions
|
@ -21,6 +21,10 @@ export async function getGroupHandler(req: Request, res: Response): Promise<void
|
|||
|
||||
const group = await getGroup(classId, assignmentId, groupId, full);
|
||||
|
||||
if (!group) {
|
||||
res.status(404).json({ error: 'Group not found' });
|
||||
}
|
||||
|
||||
res.json(group);
|
||||
}
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ describe('Group controllers', () => {
|
|||
await getGroupHandler(req as Request, res as Response);
|
||||
|
||||
expect(statusMock).toHaveBeenCalledWith(404);
|
||||
expect(jsonMock).toHaveBeenCalledWith({ error: 'Group not found' });
|
||||
expect(jsonMock).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should return 404 not found on a non-existing assignment', async () => {
|
||||
|
@ -64,7 +64,7 @@ describe('Group controllers', () => {
|
|||
await getGroupHandler(req as Request, res as Response);
|
||||
|
||||
expect(statusMock).toHaveBeenCalledWith(404);
|
||||
expect(jsonMock).toHaveBeenCalledWith({ error: 'Assignment not found' });
|
||||
expect(jsonMock).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should return 404 not found ont a non-existing class', async () => {
|
||||
|
@ -80,7 +80,7 @@ describe('Group controllers', () => {
|
|||
await getGroupHandler(req as Request, res as Response);
|
||||
|
||||
expect(statusMock).toHaveBeenCalledWith(404);
|
||||
expect(jsonMock).toHaveBeenCalledWith({ error: 'Class not found' });
|
||||
expect(jsonMock).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should return an existing group', async () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue