It's documentation says that while dealing with async code, expect.assertions(x) should be written. What exactly do assertions refer to? Is it a term of plain JavaScript?
1 Answer
In this context, it's testing terminology, it doesn't have a special meaning.
With expect.assertions(n), you're telling Jest that you expect the current test to perform n assertions. An assertion is a check that values meet certain conditions.
In other words, if you use expect.assertions(5) the test will fail unless expect() is called at least 5 times.
This is useful for async tests, but it's not the only way to handle asynchronicity, you can find other patterns in the Jest doc.