add test for not found msg
This commit is contained in:
parent
5595a29352
commit
80dddd9a55
@ -3,6 +3,7 @@ import { waitForService, baseUrl, doorName, buzzerNumber, key, buzzerUrl } from
|
|||||||
import { DoorStatus } from "../src/types/DoorStatus";
|
import { DoorStatus } from "../src/types/DoorStatus";
|
||||||
import { StatusResponse } from "../src/functions/api/door/status";
|
import { StatusResponse } from "../src/functions/api/door/status";
|
||||||
import { sleep } from "bun";
|
import { sleep } from "bun";
|
||||||
|
import { InfoResponseClient } from "../src/functions/api/door/info";
|
||||||
|
|
||||||
// these tests should only run locally
|
// these tests should only run locally
|
||||||
if (process.env.STAGE === 'staging') {
|
if (process.env.STAGE === 'staging') {
|
||||||
@ -21,6 +22,15 @@ describe("info path works", () => {
|
|||||||
expect(resp.buzzer).toBe(buzzerNumber);
|
expect(resp.buzzer).toBe(buzzerNumber);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("unknown info repsonds with a msg", async () => {
|
||||||
|
const resp = await fetch(baseUrl + `/api/door/info?door=baddoor`);
|
||||||
|
|
||||||
|
expect(resp.status).toBe(404);
|
||||||
|
const body = await resp.json() as any;
|
||||||
|
expect(body.msg).toContain("not registered");
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
test("info works from client", async () => {
|
test("info works from client", async () => {
|
||||||
const resp = await fetch(baseUrl + `/api/door/info?buzzer=${buzzerNumber}`).then(res => res.json()) as any;
|
const resp = await fetch(baseUrl + `/api/door/info?buzzer=${buzzerNumber}`).then(res => res.json()) as any;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user