Module

x/deno_slack_hooks/dev_deps.ts>mockFetch.mock

Helper library implementing the contract between the Slack CLI and Slack application SDKs
Go to Latest
variable mockFetch.mock
import { mockFetch } from "https://dotland.deno.dev/x/deno_slack_hooks@0.5.0/dev_deps.ts";
const { mock } = mockFetch;

Mock a new route, or override an existing handler.

The route uses URLPattern syntax, with the additional extension of (optional) method routing by prefixing with the method, eg. "POST@/user/:id".

The handler function may be asynchronous.

mock("GET@/users/:id", async (_req, params) => {
  const id = parseInt(params["id"]);
  const data = await magicallyGetMyUserData(id);
  return new Response(JSON.stringify(data));
})