This is a screenshot of someone else’s screenshot from #gethelp.
I read the code as 37
being expected (toBe(37)
)
But the Test Failure says Expected: 7
. Do we have some language back-to-front somewhere or am I misunderstanding?
This is a screenshot of someone else’s screenshot from #gethelp.
I read the code as 37
being expected (toBe(37)
)
But the Test Failure says Expected: 7
. Do we have some language back-to-front somewhere or am I misunderstanding?
Note: TypeScript for those wondering.
@ihid Is the first line failing or the last line failing. Because if the first line is failing the test failure is exactly how you read and expect it.
If it really is the last line, looks like a jest
bug.
expect(received).toBe(expected)
is correct, which should then obviously say
We do not self-generate those values or that message.
The first test was failing.
Would it make sense to have one expect per test?
No, not necessarily. You’d often have multiple expects and here they are not testing different behaviour.
In this case it’s doing exactly as expected, but the “issue” here is that the 7
and 37
are too easy to confuse.
I just read the entire thread on discord. This was a typical X-Y.
The student even established their code was broken by the time they started posting screenshots.
To confuse students less, other numbers may be chosen for the third or first line (we’ll take a PR!) but sigh
I see. I misunderstood. Thanks for clarifying. This is more PEBCAC than anything I think, so feel free to ignore me posting here.
(Thanks Isaac for correcting my language!)