Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

Response assertion function for unit testing

Compare
Choose a tag to compare
@jamesseanwright jamesseanwright released this 13 Nov 17:29
· 485 commits to master since this release
  • Bumps Deno to v0.23.0
  • Adds response assertion function for unit testing:
import { jsonResponse, assertResponsesMatch } from "https://raw.githubusercontent.com/jamesseanwright/reno/v0.4.0/reno/mod.ts";

test({
  name: "ronSwansonQuoteHandler should fetch a quote from an API and return it",
  async fn() {
    // [...]
    const response = await ronSwansonQuoteHandler(req);

    /* Will deeply compare headers and
     * convert body bytes to strings */
    assertResponsesMatch(response, jsonResponse(quotes, {
      "X-Foo": "bar"
    }));
  }
});