feat: testen voor assignment controller geimplementeerd
This commit is contained in:
parent
58bfa90474
commit
dbe7807f4a
3 changed files with 97 additions and 19 deletions
|
@ -2,19 +2,6 @@ import { setupTestApp } from '../setup-tests.js';
|
|||
import { describe, it, expect, beforeAll, beforeEach, vi, Mock } from 'vitest';
|
||||
import { Request, Response } from 'express';
|
||||
import { createGroupHandler, getAllGroupsHandler, getGroupHandler, getGroupSubmissionsHandler } from '../../src/controllers/groups.js';
|
||||
import { G } from 'vitest/dist/chunks/reporters.66aFHiyX.js';
|
||||
|
||||
async function test404<T>(
|
||||
req: Partial<Request<T>> ,
|
||||
res: Partial<Response>,
|
||||
handler: (req: Request<T>, res: Response) => Promise<void>,
|
||||
expectedMessage: string
|
||||
) {
|
||||
await handler(req as Request<T>, res as Response);
|
||||
|
||||
expect(res.status).toHaveBeenCalledWith(404);
|
||||
expect(res.json).toHaveBeenCalledWith({ error: expectedMessage });
|
||||
}
|
||||
|
||||
function createRequestObject(classid: string, assignmentid: string, groupNumber: string) {
|
||||
return {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue