RxRest Assert
Assertion library for RxRest
.
npm install rxrest-assert --save-dev
Example
const RxRestAssert = const assert = assert rxrest
API
The API is inspired by the angular $httpBackend service.
Expect
Expectations must respect requests order.
Parameters
Param | Type | Details |
---|---|---|
method | string | HTTP method |
url | string or RegExp | HTTP url or RegExp to match requested url |
request | Request | The expected Request. It's url query params or headers will be tested against the request |
For example, to match headers and query parameters:
let headers = headers assert
Returns
Returns an object with a respond
method:
- If the response is an Object it'll be the response body (json encoded).
- If it's a number, it will be the reponse status
- If it's a Response instance, it's taken as is
Aliases
When
When
doesn't depend on the requests order and it's signature is {method, url}
.
The API is the same as expect:
Aliases
whenGET(url, request)
whenPOST(url, request)
whenPUT(url, request)
whenHEAD(url, request)
whenPATCH(url, request)
whenDELETE(url, request)