summary refs log tree commit diff stats
path: root/test
diff options
context:
space:
mode:
authorAlan Pearce2023-09-11 14:52:07 +0200
committerAlan Pearce2023-09-11 14:52:07 +0200
commita25028aa30bf0f3b89a9a7c99192e1a14267fc97 (patch)
tree94aa059e8f6d9145d5489c96802d82859db612dc /test
downloadwebsite-a25028aa30bf0f3b89a9a7c99192e1a14267fc97.tar.lz
website-a25028aa30bf0f3b89a9a7c99192e1a14267fc97.tar.zst
website-a25028aa30bf0f3b89a9a7c99192e1a14267fc97.zip
Initial commit
Diffstat (limited to 'test')
-rw-r--r--test/index.test.ts21
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")
+})