about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlan Pearce2024-04-18 21:36:03 +0200
committerAlan Pearce2024-04-18 21:36:03 +0200
commitf20b2c91f779d6b825ee94cb133ea19bf5db5c66 (patch)
tree83e4dae138364c23fa73338b88d076c27d72fc55
parent9e072083313c8cdf4cc4d44392c08f7b1b782dba (diff)
downloadwebsite-f20b2c91f779d6b825ee94cb133ea19bf5db5c66.tar.lz
website-f20b2c91f779d6b825ee94cb133ea19bf5db5c66.tar.zst
website-f20b2c91f779d6b825ee94cb133ea19bf5db5c66.zip
remove old typescript test file
-rw-r--r--test/index.test.ts97
1 files changed, 0 insertions, 97 deletions
diff --git a/test/index.test.ts b/test/index.test.ts
deleted file mode 100644
index 6e29e3d..0000000
--- a/test/index.test.ts
+++ /dev/null
@@ -1,97 +0,0 @@
-import { type Server } from "bun";
-import { expect, test, beforeAll, afterAll } from "bun:test";
-
-import { server as app } from "../src/app";
-
-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("/ returns 200", async function () {
-  const res = await fetch(base);
-  expect(res.status).toBe(200);
-});
-
-test("/asdf returns 404", async function () {
-  const res = await fetch(`${base}asdf`);
-  expect(res.status).toBe(404);
-});
-
-test("/ returns 304 with newer if-modified-since header", async function () {
-  const res = await fetch(base, {
-    headers: {
-      "if-modified-since": new Date().toUTCString(),
-    },
-  });
-  expect(res.status).toBe(304);
-  expect(res.headers.get("vary")).toBe("Accept-Encoding");
-});
-
-test("/ returns 200 with older if-modified-since header", async function () {
-  const res = await fetch(base, {
-    headers: {
-      "if-modified-since": new Date(0).toUTCString(),
-    },
-  });
-  expect(res.status).toBe(200);
-});
-
-test("/ returns gzipped content with accept-encoding: gzip", async function () {
-  const res = await fetch(base, {
-    headers: {
-      "accept-encoding": "gzip",
-    },
-  });
-  expect(res.status).toBe(200);
-  // Bun 0.8.1 this doesn't work, but `verbose` shows it's there
-  // expect(res.headers.get("content-encoding")).toBe("gzip");
-  // response is automatically gunzipped
-  const body = await res.text();
-  expect(body.length).toBeGreaterThan(
-    Number(res.headers.get("content-length")),
-  );
-});
-
-test("/ returns uncompressed content with accept-encoding: identity", async function () {
-  const res = await fetch(base, {
-    headers: {
-      "accept-encoding": "identity",
-    },
-  });
-  expect(res.status).toBe(200);
-  const body = await res.text();
-  expect(body.length).toBe(Number(res.headers.get("content-length")));
-});
-
-test("/ returns brotli-compressed content with accept-encoding: br", async function () {
-  const res = await fetch(base, {
-    headers: {
-      "accept-encoding": "br",
-    },
-  });
-  expect(res.status).toBe(200);
-  expect(res.headers.get("content-encoding")).toBe("br");
-  const body = await res.text();
-  expect(body.length).toBeLessThan(Number(res.headers.get("content-length")));
-});
-
-test("/ returns zstd-compressed content with accept-encoding: zstd", async function () {
-  const res = await fetch(base, {
-    headers: {
-      "accept-encoding": "zstd",
-    },
-  });
-  expect(res.status).toBe(200);
-  expect(res.headers.get("content-encoding")).toBe("zstd");
-  expect(res.headers.get("vary")).toBe("Accept-Encoding");
-  const body = await res.text();
-  expect(body.length).toBeLessThan(Number(res.headers.get("content-length")));
-});