Creating a unit test in Teasim is easy.

You can use bun:test to create a unit test with Teasim.

Teasim instance has a handle method that accepts Request and will return a Response, the same as creating an HTTP request.

import { describe, expect, it } from "bun:test";

describe("Teasim", () => {
  it("return a response", async () => {
    const app = new Teasim().get("/", () => "hi");

    const response = await app.handle(new Request("http://localhost/")).then(res => res.text());


You can also use other testing libraries like Jest to create a unit test for Teasim, but we recommended to use bun:test over others.


When creating a Request to Teasim server, Teasim expects an entire valid URL, NOT a part of a URL.

For instance, "http://localhost/" is valid but "/user" is not.