Const
Test that resource handle method.
method
This is a test macro. It can be used to test handling any HTTP method supported by SuperAgent.
Example use of this test in typescript:
import anyTest, { TestInterface } from "ava";import express from "express";import superTest from "supertest";import * as restHALTestTools from "@yeiniel/rest-hal-test-tools";const test = anyTest as TestInterface<restHALTestTools.IContext>;test.beforeEach((t) => { const app = express(); // provide an endpoint handler for the GET method app.get("/", (_, res) => { res.end(); }); app.post("/", (_, res) => { res.status(405).end(); }); t.context.agent = superTest(app); t.context.resource = "/";});// resource handle get requeststest(restHALTestTools.implement, "get");// resource do not handle post requeststest(restHALTestTools.implement, "post", false);
Test execution context
Http method
Whether it is expected or not that resource handle method (true by default)
Generated using TypeDoc
Test that resource handle
method
.This is a test macro. It can be used to test handling any HTTP method supported by SuperAgent.
Example use of this test in typescript:
Param
Test execution context
Param
Http method
Param
Whether it is expected or not that resource handle
method
(true by default)