fix: student join req by class route + teacher return post put delete + status

This commit is contained in:
Gabriellvl 2025-04-01 14:24:06 +02:00
parent c0995d3933
commit 912369f87e
9 changed files with 106 additions and 47 deletions

View file

@ -11,8 +11,8 @@ import {
getStudentSubmissionsHandler,
getStudentQuestionsHandler,
createStudentRequestHandler,
getStudentRequestHandler,
deleteClassJoinRequestHandler,
getStudentRequestsHandler,
deleteClassJoinRequestHandler, getStudentRequestHandler,
} from '../../src/controllers/students.js';
import { TEST_STUDENTS } from '../test_assets/users/students.testdata.js';
import { NotFoundException } from '../../src/exceptions/not-found-exception.js';
@ -176,7 +176,7 @@ describe('Student controllers', () => {
params: { username: 'PinkFloyd' },
};
await getStudentRequestHandler(req as Request, res as Response);
await getStudentRequestsHandler(req as Request, res as Response);
expect(jsonMock).toHaveBeenCalledWith(
expect.objectContaining({
@ -189,6 +189,20 @@ describe('Student controllers', () => {
expect(result.requests.length).toBeGreaterThan(0);
});
it('Get join request by student', async () => {
req = {
params: { username: 'PinkFloyd', classId: 'id02' },
};
await getStudentRequestHandler(req as Request, res as Response);
expect(jsonMock).toHaveBeenCalledWith(
expect.objectContaining({
request: expect.anything(),
})
);
});
it('Create join request', async () => {
req = {
params: { username: 'Noordkaap' },