Unexpected call: test(1234) Expected test(1234) once (never called)on our tests, where the first line is what was actually called, and the second line is what was expected. They appear identical.
Here's some tests that illustrate what the problem is:
Can you spot the difference? It turns out that the id field in the book object is actually a string, and not an integer! Obviously the error output is just converting all the arguments to strings before outputting, and so there's no way to tell what type they are just by looking at the output. To fix this, I'll add a test to the
Book
object to ensure that it converts strings passed in to integers and update the relevant lines in app.js.It really annoys me that such a silly thing took up so much of my time though.
No comments:
Post a Comment