refactor: tests adriaan

This commit is contained in:
Gabriellvl 2025-05-10 20:02:51 +02:00
parent ded1a5908e
commit 2d841e7955
7 changed files with 99 additions and 178 deletions

View file

@ -25,7 +25,7 @@ app.use(responseTime(responseTimeLogger));
app.use('/api', apiRouter);
// Swagger
app.use('/api-docs', swaggerUi.serve, swaggerMiddleware);
// app.use('/api-docs', swaggerUi.serve, swaggerMiddleware);
app.use(errorHandler);

View file

@ -62,6 +62,11 @@ export async function getAllSubmissionsHandler(req: Request, res: Response): Pro
// TODO: gerald moet nog dingen toevoegen aan de databank voor dat dit gefinaliseerd kan worden
export async function createSubmissionHandler(req: Request, res: Response): Promise<void> {
const submitter = req.body.submitter;
const usernameSubmitter = req.body.submitter.username;
const group = req.body.group;
requireFields({ group, submitter, usernameSubmitter });
const submissionDTO = req.body as SubmissionDTO;
const submission = await createSubmission(submissionDTO);

View file

@ -42,7 +42,7 @@ export async function fetchStudent(username: string): Promise<Student> {
const user = await studentRepository.findByUsername(username);
if (!user) {
throw new NotFoundException('Student with username not found');
throw new NotFoundException(`Student with username ${username} not found`);
}
return user;