feat: guard against empty terms in createGameSession
This commit is contained in:
parent
1e30f04e81
commit
3d16ab0fff
4 changed files with 62 additions and 0 deletions
|
|
@ -110,6 +110,15 @@ describe("POST /api/v1/game/start", () => {
|
|||
expect(res.status).toBe(400);
|
||||
expect(body.success).toBe(false);
|
||||
});
|
||||
|
||||
it("returns 404 when no terms are found for the given filters", async () => {
|
||||
mockGetGameTerms.mockResolvedValue([]);
|
||||
|
||||
const res = await request(app).post("/api/v1/game/start").send(validBody);
|
||||
const body = res.body as ErrorResponse;
|
||||
expect(res.status).toBe(404);
|
||||
expect(body.success).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("POST /api/v1/game/answer", () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue