about summary refs log tree commit diff stats
path: root/test/index.test.ts
blob: d82cb9e86f9769531186d534ea4079b89c4926a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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")
})