diff --git a/tests/routes/things/create.test.ts b/tests/routes/things/create.test.ts index 65e9935..73f51fb 100644 --- a/tests/routes/things/create.test.ts +++ b/tests/routes/things/create.test.ts @@ -4,16 +4,26 @@ import { test, expect } from "bun:test" test("create a thing", async () => { const { ky } = await getTestServer() - ky.post("things/create", { - json: { + const createData = await ky + .post("things/create", { + json: { + name: "Thing1", + description: "Thing1 Description", + }, + }) + .json<{ ok: boolean }>() + + expect(createData.ok).toBe(true) + + const data = await ky.get("things/list").json<{ + things: { thing_id: string; name: string; description: string }[] + }>() + + expect(data.things).toEqual([ + { + thing_id: expect.any(String), name: "Thing1", description: "Thing1 Description", }, - }) - - const data = await ky - .get("things/list") - .json<{ things: { name: string; description: string }[] }>() - - expect(data.things).toHaveLength(1) + ]) })