Open
Conversation
substitute Array.includes with Array.indexOf
… POST@[filename].mock
juarezs
reviewed
Jun 12, 2020
| var data = fs.readFileSync(join(fullPath, file), { encoding: 'utf8' }); | ||
|
|
||
| try { | ||
| if (jsonBody === JSON.stringify(JSON.parse(data))) { |
There was a problem hiding this comment.
I think you could change this check to if (JSON.stringify(JSON.parse(jsonBody)) === JSON.stringify(JSON.parse(data))) { to avoid a falsy result due to an extra white space or some other formatting detail.
There was a problem hiding this comment.
I agree with that because without it, it couldn't work correctly (if some space character exist for example)
|
Hello. Any news for this PR? It will be great if we can use it under Windows 👍 Regards, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Modified previously submitted PR #44 for responding to POST requests with different mocks based on the requests body. This should resolve #38. I haven't run in to issues on Windows.
I also updated some of the tests' mock folders to be a little more descriptive of what they were doing.
Lastly, I changed the file format for these mock files to be:
POST@[json file name without extension].mock