diff options
Diffstat (limited to 'test/index.test.ts')
-rw-r--r-- | test/index.test.ts | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/index.test.ts b/test/index.test.ts new file mode 100644 index 0000000..d82cb9e --- /dev/null +++ b/test/index.test.ts @@ -0,0 +1,21 @@ +import { type Server } from "bun" +import { expect, test, beforeAll, afterAll } from "bun:test" + +import app from "../src/index" + +const port = 33000; +let server: Server + +beforeAll(async function () { + server = Bun.serve(Object.assign({}, app, { port })) +}) + +afterAll(function () { + server.stop() +}) + +test("/status returns 200 OK", async function () { + const res = await fetch(`http://localhost:${port}/status`) + expect(res.status).toBe(200) + expect(await res.text()).toBe("OK") +}) |