import { type Server } from "bun"; 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 () { server = Bun.serve(Object.assign({}, app, { port })); }); afterAll(function () { server.stop(); }); test("/status returns 200 OK", async function () { 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"); });