Variable optionsAllowConst

optionsAllow: Macro<[HttpMethod, boolean?], IContext> = ...

Test that resource options handler indicate that method is allowed.

This is a test macro. It can be used to test if any method is indicated to be allowed.

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

t.context.agent = superTest(app);
t.context.resource = "/";
});

// resource options allow get
test(restHALTestTools.optionsAllow, "get");

// resource options do not allow post
test(restHALTestTools.optionsAllow, "post", false);

Param

Test execution context

Param

Http method

Param

Whether it is expected or not that resource options handler allow method (true by default)

Generated using TypeDoc