docs

Tests

For test routes from the api, you can use the Supertest. You can import Supertest from: import { Supertest } from "@hefestos/core"; and use like:

import { describe, it, expect } from "bun:test";
import { Supertest } from "@hefestos/core";

descript("List posts", () => {
  it("Successfully list the posts", async () => {
    // Creating some posts for the list
    // ...

    // Main request
    const { body, status } = await Supertest.get("/posts");

    expect(status).toBe(200);
    expect(body).toEqual(
      expect.objectContaining({
        status: "OK",
        error: null,
        // result: ...
      })
    );
  });
});

We use Bun test module and Supertest. For more references about Supertest, access the official documentation at https://github.com/ladjs/supertest.

Summary