Get support for soyuka/rxrest-assert
If you're new to LTH, please see our FAQ for more information on what it is we do.
Support Options
Unfortunately, there are currently no active helpers for this repository on the platform. Until they become available, we reccomend the following actions:
View Open IssuesTake a look to see if anyone else has experienced the same issue as you and if they managed to solve it.
Open an IssueMake sure to read any relevant guidelines for opening issues on this repo before posting a new issue.
Sponsor directlyCheck out the page and see if there are any options to sponsor this project or it's developers directly.
soyuka/rxrest-assert
RxRest Assert 
Assertion library for RxRest
.
npm install rxrest-assert --save-dev
Example
const {RxRestAssert} = require('rxrest-assert')
const assert = new RxRestAssert(new RxRestConfiguration())
assert.expectGET('foo')
.respond({foo: 'bar', id: 1})
rxrest.one('foo')
.post()
.then(e => {
})
.catch(e => {
console.log(e.message) //Method should be "GET", got "POST"
})
API
The API is inspired by the angular $httpBackend service.
Expect
Expectations must respect requests order.
expect(method, url, [request])
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 = new Headers()
headers.set('Authorization', 'Bearer foo')
assert.expect('GET', 'foo', new Request('foo?test=foobar', {headers: headers})
rxrest
.one('foo')
.get({test: 'foobar'}, {'Authorization': 'Bearer foo'})
.then(e => {})
.catch(e => {})
Returns
Returns an object with a respond
method:
respond(response: Response|Object|number)
- 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
expectGET(url, request)
expectPOST(url, request)
expectPUT(url, request)
expectHEAD(url, request)
expectPATCH(url, request)
expectDELETE(url, request)
When
When
doesn't depend on the requests order and it's signature is {method, url}
.
The API is the same as expect:
when(method, url, [request])
Aliases
whenGET(url, request)
whenPOST(url, request)
whenPUT(url, request)
whenHEAD(url, request)
whenPATCH(url, request)
whenDELETE(url, request)
Our Mission
We want to make open source more sustainable. The entire platform was born from this and everything we do is in aid of this.
From the Blog
Interesting Articles
-
Generating income from open source
Jun 23 • 8 min read
-
2023 State of OSS
Apr 23 • 45 min read ★
-
A funding experiment...
Aug 19 • 10 min read
-
But You Said I could
Aug 19 • 2 min read
Thank you for checking out LiveTechHelper |
2025 © lth-dev incorporated
p-e622a1a2