diff options
author | Alan Pearce | 2023-09-11 14:52:07 +0200 |
---|---|---|
committer | Alan Pearce | 2023-09-11 14:52:07 +0200 |
commit | a25028aa30bf0f3b89a9a7c99192e1a14267fc97 (patch) | |
tree | 94aa059e8f6d9145d5489c96802d82859db612dc /test/index.test.ts | |
download | website-a25028aa30bf0f3b89a9a7c99192e1a14267fc97.tar.lz website-a25028aa30bf0f3b89a9a7c99192e1a14267fc97.tar.zst website-a25028aa30bf0f3b89a9a7c99192e1a14267fc97.zip |
Initial commit
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") +}) |