Human-readable is importantFor this use
BDD-style assertions library that provides interface with "human-readable" keywords. The
should, expect, assert provided by Chai are perfect regarding this problem.
Be sure of what you testing Right internals testing such testing server's backend is really expensive in terms of time but not guarantee that external things (like API) will work perfectly.
Meanwhile right external testing such testing server's API isn't such expensive but will test the internal things implicitly and external things explicitly (like API).
Don't use unrealistic data, approximate production conditions Nice real data generator:
Faker.
Simplify your tools, minimize third-party libraries and abstraction This will help a lot to other readers of your tests.
before and beforeEach aren't equal
Code in
before block runs once before all the tests in "parent" describe block Code in
beforeEach runs before each test in "parent" describe block. Same for
after and
afterEach.
Use done for synchronous checks.