@miqro/test-http
v0.1.4
Published
test a `RequestListener` without a running server.
Readme
@miqro/test-http
test a RequestListener without a running server.
TestHelper
spins up a real http server on a UUID Unix socket, makes one request, tears it down.
import { TestHelper } from "@miqro/test-http";
import { strictEqual } from "assert";
const res = await TestHelper(
myRequestListener,
{
url: "/api/posts",
method: "GET",
disableThrow: true
}
);
strictEqual(res.status, 200);or pass an App instance:
import { App } from "@miqro/core";
const app = new App();
app.use(myRouter);
const res = await TestHelper(app, { url: "/posts", method: "GET", disableThrow: true });request options are the same as @miqro/request.
useful for testing individual routers or handlers in isolation without the full miqro stack.
