From a25028aa30bf0f3b89a9a7c99192e1a14267fc97 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Mon, 11 Sep 2023 14:52:07 +0200 Subject: Initial commit --- test/index.test.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 test/index.test.ts (limited to 'test/index.test.ts') 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") +}) -- cgit 1.4.1