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
OK: DB.test.js -> routes.test.js
Problem: routes.test.js -> DB.test.js as we are adding an item to Orders Collection in one of our tests in routes.test.js. This results in one test in DB.test.js to fail as we do not expect this added item.
Solutions:
Avoid side effects by dropping this document after we assert it has been successfully added
Refactor code such that we clear DB and re-populate in jest beforeAll for each test suite (but then DB.test.js isn't really that useful anymore?)
devYaoYH
changed the title
Testing order matters that DB.test.js is the first to be run
[Server] Testing order matters that DB.test.js is the first to be run
Jun 19, 2020
SGTM!
2# seems like a better approach in long run! Perhaps just copy over the DB from DB.test.js into a new one in beforeAll and then delete it in AfterAll. The items stay neat then.
Potential test ordering fix for Jest:
jestjs/jest#6194 (comment)
Currently we are doing:
OK:
DB.test.js
->routes.test.js
Problem:
routes.test.js
->DB.test.js
as we are adding an item to Orders Collection in one of our tests inroutes.test.js
. This results in one test inDB.test.js
to fail as we do not expect this added item.Solutions:
beforeAll
for each test suite (but thenDB.test.js
isn't really that useful anymore?)For now, I've taken the earlier approach
Originally posted by @devYaoYH in #104
The text was updated successfully, but these errors were encountered: