In referee, we have assert.json(actual, expected) which attempts to parse actual with JSON.parse and compares the result to expected. It would be nice to have a matcher that does the same and can be used like this:
assert.equals(actual, {
some: 'thing',
json: match.json({
parsed: true
})
});
Or with sinon assertions:
sinon.assert.calledWith(fake, match.json({
my: 'json'
}));
I'm unsure about a naming ambiguity though: We also have assert.matchJson(actual, expectation) which parses actual with JSON.parse and compares the result to expected using the same semantics of assert.match.
How would match.json behave? And what would be the counterpart?
In referee, we have
assert.json(actual, expected)which attempts to parseactualwithJSON.parseand compares the result toexpected. It would be nice to have a matcher that does the same and can be used like this:Or with sinon assertions:
I'm unsure about a naming ambiguity though: We also have
assert.matchJson(actual, expectation)which parsesactualwithJSON.parseand compares the result toexpectedusing the same semantics ofassert.match.How would
match.jsonbehave? And what would be the counterpart?