Module

x/aleph/server/mock.ts>MockServer

The Full-stack Framework in Deno.
Very Popular
Latest
class MockServer
import { MockServer } from "https://deno.land/x/aleph@1.0.0-beta.21/server/mock.ts";

The MockServer class to create a minimal server for integration testing.

Examples

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);
})

Constructors

new
MockServer(options?: MockServerOptions)

Methods

fetch(input: string, init?: RequestInit)