-
Notifications
You must be signed in to change notification settings - Fork 19
Open
Labels
Description
nock has several customization options that would be nice to implement in ember-cli-fastboot-testing's network mocking. Just to mention a few:
- Setting of the hostname - Currently, we are limited to using the same hostname as the test runner. Oftentimes we have a separate api host that we'd like to override.
- Customizing the path - Currently, we can only use exact path matches - it would be great to be able to use RegEx or the
includesoption. - Customizing the query string - Similar to above, it would be really helpful to explicitly specify the query string, use regex, or use nock's
.query(true)option to ignore the query string altogether. Otherwise, it's only a match if the query string is appended to the url with the exact full string.
We also have this issue: https://github.com/embermap/ember-cli-fastboot-testing/issues
It seems like we either need a way to use nock's syntax when creating these mocks, or expand the API to allow several different customization options. Maybe something like:
await mockServer.get('/api/posts/1', { <body>}, { <options> } )
(we'd have to move the status code into an option, and maybe deprecate the string as a 3rd param)
I'd be happy to work on a PR for this once we land on the approach.
CvX and ryanto