Fix body parsing and add integration test suite #10
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
Fixes #9 and an issue where paths without params would break when attempting to inject the parameters.
To help prevent regressions this PR introduces
msw
to mock HTTP requests.Explanation of Changes
We have to spin up a new data proxy server on a different port every test as for some reason calling
await server.stop()
doesn't fully close the proxy server and the next test will spin up a new server on the same port, but the old server receives the request.We could also do something where we initially prepare a bunch of testcases and attach all the routes to a single proxy, but I didn't want to invest too much time right now.
I also replaced jsonpath with jsonpath-plus as jsonpath required the node_modules directory to be in place as it needs to read files during runtime execution.
Testing
Added integration tests that failed before implementing the fixes.
Related PRs and Issues
Closes: #9
Spawns: #11 #12