You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The reason is that the function assertWith counts all the occurrences of the parameters for each argument and then expects it to be equal to the length of the arguments.
Assertion (1) will fail because 1 appears twice in the arguments list, but the length of the with arguments is 1.
Assertion (2) will also fail because 1 appears twice in the arguments list, so for every with argument it is counted twice, so it's been found "4" times.
The text was updated successfully, but these errors were encountered:
Asserting that a function has been called with a given parameter fails if that function was called with that parameter with an arity greater than one.
For example, the following assertions fail if the function
sum
is called withsum(1, 1)
.expect(sum).to.have.been.called.with(1)
(1)expect(sum).to.have.been.called.with(1, 1)
(2)The reason is that the function
assertWith
counts all the occurrences of the parameters for each argument and then expects it to be equal to the length of the arguments.Assertion (1) will fail because
1
appears twice in the arguments list, but the length of thewith
arguments is 1.Assertion (2) will also fail because
1
appears twice in the arguments list, so for everywith
argument it is counted twice, so it's been found "4" times.The text was updated successfully, but these errors were encountered: