example.test.ts
import { describe, test, expect } from "bun:test";
import { createApp } from "canxjs";
describe("API Tests", () => {
test("GET / returns hello message", async () => {
const app = createApp({ port: 0 });
app.get("/", (req, res) => {
res.json({ message: "Hello CanxJS!" });
});
const response = await app.request("/");
const data = await response.json();
expect(response.status).toBe(200);
expect(data.message).toBe("Hello CanxJS!");
});
});