Interact or test REST resources from the command line.
$ npm install @testingrequired/restspec@0.0.0
A rest file defines a single request with optional tests. They are plain javascript files that are intended to be edited as code. They should live with your project's tests.
The format for rest files is not stable and is subject to change with any new release.
Rest files can be located anywhere.
// ./tests/rest/example.js
module.exports = {
name: "Example",
method: "GET",
url: "http://example.com/",
headers: {
"Content-Type": "application/json"
},
redirect: "follow",
tests: (response, assert) => [() => assert.equal(response.status, 200)]
};
string
string
string
{[string]: string}
follow | error | manual
any
Calls url and prints response from rest file
$ restspec run ./tests/rest/google.js
Calls url and runs tests from rest file
$ restspec test ./tests/rest/google.js
MIT - see LICENSE