-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Expand file tree
/
Copy pathindex.test.ts
More file actions
38 lines (34 loc) · 915 Bytes
/
index.test.ts
File metadata and controls
38 lines (34 loc) · 915 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { describe, expect, test } from "bun:test";
import app from "../app";
describe("GET /", () => {
test("returns server metadata and endpoints", async () => {
const response = await app.fetch(new Request("http://localhost/"));
expect(response.status).toBe(200);
const data = await response.json();
expect(data).toEqual({
name: "@cap/media-server",
version: "1.0.0",
endpoints: [
"/health",
"/audio/status",
"/audio/check",
"/audio/extract",
"/audio/convert",
"/video/status",
"/video/probe",
"/video/thumbnail",
"/video/process",
"/video/process/:jobId/status",
"/video/process/:jobId/cancel",
],
});
});
});
describe("unknown routes", () => {
test("returns 404 for unknown GET routes", async () => {
const response = await app.fetch(
new Request("http://localhost/unknown-route"),
);
expect(response.status).toBe(404);
});
});