VRMS icon indicating copy to clipboard operation
VRMS copied to clipboard

Epic: Write new backend integration tests for router-controller-model flow

Open dannyprikaz opened this issue 9 months ago • 0 comments

Overview

MongoDB backend tests are failing intermittently due to the state of the database not being properly reset between tests. We need narrative-style integration tests for each router, where the end state of each test can be used as the start state of the next test.

Additional Information: Our current backend tests that access MongoDB are intermittently failing because the state of the database is not resetting properly between tests. We need to write new integration tests that flow like a narrative for each express route, i.e. for `user.router.js` we need a set of tests that first create a user, then read, update, and delete; where each test depends on the end state of the previous test. This will ensure that our tests don't fail intermittently. We may however want to implement the tests such that as soon as one test in a flow fails, the rest are skipped, because presumably, the state won't have been set properly and the remaining tests would fail.

Action Items

First we need to re-configure jest and our directory structure to accommodate the development of new tests:

  • [x] #1898
  • [x] #1900

Then we need to write new integration tests based on the routes of each router:

  • [x] #1935
  • [ ] #1948
  • [ ] #1949

Resources/Instructions

https://jestjs.io/docs/configuration https://jestjs.io/docs/getting-started https://softwareengineering.stackexchange.com/questions/221766/how-to-structure-tests-where-one-test-is-another-tests-setup

For an example, please view #1945

dannyprikaz avatar Apr 02 '25 17:04 dannyprikaz