-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Examples with Testing #4
Comments
Yup, that's right. I will try to update the docs with a new topic inside |
Solved with introduction of |
Sorry to comment on a closed issue or if I am in the wrong place, but I'm having a lot of trouble trying to test both ways I'm using I tried to upgrade to 4, but I had a lot of problems with I'm trying to do a very simple test: The endpoint: import { r } from '@marblejs/core'
import { mapTo } from 'rxjs/operators'
export const helloThere = r.pipe(
r.matchPath('/'),
r.matchType('GET'),
r.useEffect(req => req.pipe(mapTo({ body: 'Hello there!' }))),
) The test using jest: const listener = httpListener({ effects: [helloThere] })
const httpTestBed = createHttpTestBed({
listener,
})
it('should return OK', async () => {
const { request, finish } = await httpTestBed()
const response = await pipe(
request('GET'),
request.withPath('/'),
request.send,
)
expect(response.statusCode).toEqual(200)
await finish()
}) But I've got the error:
Am I doing anything wrong? The example with supertest doesn't work either.
Thanks for your attention. |
That example helped a lot! Thanks!! I had seen only this example that I was not able to reproduce, probably because it was v2
But I'm getting a strange promise error on Jest. Do you have any idea the reason? |
@viglioni probably because you import the I highly recommend to separate |
Thanks a lot! Also congratulations for the lib :) |
We need examples for how to test the endpoints.
For example here is what I did:
The text was updated successfully, but these errors were encountered: