summary refs log tree commit diff stats
path: root/test/index.test.ts
diff options
context:
space:
mode:
authorAlan Pearce2023-09-11 19:43:06 +0200
committerAlan Pearce2023-09-11 19:43:06 +0200
commit51cc4389f6dc7947ee34d1b3367876941e8a8fbc (patch)
tree300ad6bc3cdfcdbbc73e7a543e0807c2da6b7785 /test/index.test.ts
parenta25028aa30bf0f3b89a9a7c99192e1a14267fc97 (diff)
downloadwebsite-51cc4389f6dc7947ee34d1b3367876941e8a8fbc.tar.lz
website-51cc4389f6dc7947ee34d1b3367876941e8a8fbc.tar.zst
website-51cc4389f6dc7947ee34d1b3367876941e8a8fbc.zip
Serve static files
Diffstat (limited to 'test/index.test.ts')
-rw-r--r--test/index.test.ts9
1 files changed, 8 insertions, 1 deletions
diff --git a/test/index.test.ts b/test/index.test.ts
index d82cb9e..8a32e47 100644
--- a/test/index.test.ts
+++ b/test/index.test.ts
@@ -4,6 +4,7 @@ import { expect, test, beforeAll, afterAll } from "bun:test"
 import app from "../src/index"
 
 const port = 33000;
+const base = `http://localhost:${port}/`;
 let server: Server
 
 beforeAll(async function () {
@@ -15,7 +16,13 @@ afterAll(function () {
 })
 
 test("/status returns 200 OK", async function () {
-  const res = await fetch(`http://localhost:${port}/status`)
+  const res = await fetch(new URL("/status", base))
   expect(res.status).toBe(200)
   expect(await res.text()).toBe("OK")
 })
+
+test("/ returns 200 and says Hello world", async function () {
+  const res = await fetch(base)
+  expect(res.status).toBe(200)
+  expect(await res.text()).toBe("Hello world")
+})