Skip to content

Commit

Permalink
YKI(Frontend): Return evaluation period details from msw
Browse files Browse the repository at this point in the history
  • Loading branch information
pkoivisto committed Oct 10, 2023
1 parent 1accda5 commit aea186a
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions frontend/packages/yki/src/tests/msw/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,17 @@ export const handlers = [
rest.get(APIEndpoints.Evaluations, (_, res, ctx) => {
return res(ctx.status(200), ctx.json(evaluationPeriods));
}),
rest.get(APIEndpoints.Evaluation, (req, res, ctx) => {
const { evaluationId } = req.params;
const evaluationPeriod = evaluationPeriods.evaluation_periods.filter(
(ep) => ep.id === Number(evaluationId)
)[0];
if (evaluationPeriod) {
return res(ctx.status(200), ctx.json(evaluationPeriod));
} else {
return res(ctx.status(404));
}
}),
rest.get(APIEndpoints.ExamSessions, (_, res, ctx) => {
return res(ctx.status(200), ctx.json(examSessions));
}),
Expand Down

0 comments on commit aea186a

Please sign in to comment.