feat: getallsubmissions endpoint toegevoegd
This commit is contained in:
parent
c9739a1420
commit
f0eb4822d9
4 changed files with 36 additions and 20 deletions
|
@ -2,6 +2,7 @@ import { setupTestApp } from '../setup-tests.js';
|
|||
import { describe, it, expect, beforeAll, beforeEach, vi, Mock } from 'vitest';
|
||||
import { Request, Response } from 'express';
|
||||
import { getAssignmentHandler, getAllAssignmentsHandler, getAssignmentsSubmissionsHandler } from '../../src/controllers/assignments.js';
|
||||
import { checkReturn404, checkReturnList } from './qol.js'
|
||||
|
||||
function createRequestObject(classid: string, assignmentid: string) {
|
||||
return {
|
||||
|
@ -13,19 +14,6 @@ function createRequestObject(classid: string, assignmentid: string) {
|
|||
};
|
||||
}
|
||||
|
||||
function checkReturnList(jsonMock: Mock, listName: string) {
|
||||
expect(jsonMock).toHaveBeenCalled();
|
||||
|
||||
const result = jsonMock.mock.lastCall![0];
|
||||
|
||||
expect(listName in result).toBeTruthy();
|
||||
}
|
||||
|
||||
function checkReturn404(jsonMock: Mock, statusMock: Mock) {
|
||||
expect(statusMock).toHaveBeenCalledWith(404);
|
||||
expect(jsonMock).toHaveBeenCalled();
|
||||
}
|
||||
|
||||
describe('Assignment controllers', () => {
|
||||
let req: Partial<Request>;
|
||||
let res: Partial<Response>;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue