import { MockServer } from "https://deno.land/x/aleph@1.0.0-beta.23/server/mock.ts";
The MockServer class to create a minimal server for integration testing.
Examples
Example 1
Example 1
import { assertEquals } from "std/testing/asserts.ts";
import { MockServer } from "aleph/server/mock.ts";
Deno.test(async () => {
const api = new MockServer({
routeGlob: "./routes/**\/*.ts"
});
const res = await api.fetch("/users?page=1&limit=10");
assertEquals(res.status, 200);
assertEquals((await res.json()).length, 10);
})
Methods
fetch(input: string, init?: RequestInit)