chai
chai copied to clipboard
`calledWithMatch` asserting on reference rather than copy of argument
We have a piece of code which does the following:
async caller_function(param) {
test_function(param)
param.property = 'two'
}
caller_function({property: 'one'})
And we want to assert the following:
expect(test_function).to.be.calledWithMatch({
property: 'one'
})
The issue appears to be that param.property
is overwritten by the caller_function
, and thus resulting in an assertion error.