fix: change GAME_ROUNDS from strings to numbers
This commit is contained in:
parent
7d3c456efe
commit
02ccc88d24
8 changed files with 181 additions and 14 deletions
|
|
@ -60,7 +60,7 @@ const validBody = {
|
|||
target_language: "it",
|
||||
pos: "noun",
|
||||
difficulty: "easy",
|
||||
rounds: "3",
|
||||
rounds: 3,
|
||||
};
|
||||
|
||||
const fakeTerms = [
|
||||
|
|
@ -177,4 +177,22 @@ describe("POST /api/v1/game/answer", () => {
|
|||
expect(body.success).toBe(false);
|
||||
expect(body.error).toContain("Question not found");
|
||||
});
|
||||
|
||||
it("returns 400 when a field has an invalid value", async () => {
|
||||
const res = await request(app)
|
||||
.post("/api/v1/game/start")
|
||||
.send({ ...validBody, difficulty: "impossible" });
|
||||
const body = res.body as ErrorResponse;
|
||||
expect(res.status).toBe(400);
|
||||
expect(body.success).toBe(false);
|
||||
});
|
||||
|
||||
it("returns 400 when rounds has an invalid value", async () => {
|
||||
const res = await request(app)
|
||||
.post("/api/v1/game/start")
|
||||
.send({ ...validBody, rounds: "invalid" });
|
||||
const body = res.body as ErrorResponse;
|
||||
expect(res.status).toBe(400);
|
||||
expect(body.success).toBe(false);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue