OED strives to have test code for all aspects of the project. At the current time we do not test the actual web pages. Thus, we don't automatically check that buttons click as expected or graphics show as expected. These tests are done manually. OED uses automated testing for functions, database query results, routes, etc. The automated testing mostly uses the Chai and Mocha frameworks.
The test code is located in the
src/server/test/ directory. Tests are grouped by functionality in
db/ directory), routes (
routes/ directory), etc. The main directory has
common.js that is used across many tests. It has functions to set up the test database environment, reset the
database and Mocha actions to take before/after tests and before each test is run. In general, the database is
reset before any test that uses the database to guarantee a clean environment for each test.
OED only uses a subset of the testing frameworks. Possibly the easiest way to learn how to add tests is to go to existing tests in OED that are similar to the one(s) you want to add. You can then either edit/add to an existing file (if you changed or added to an already existing feature) or create a new file (for new functionality) where you use an existing file as the template. Please make sure to run your test(s) to make sure they work. The developer details has information on running single tests.
Some newer tests are outlined in the testing design document that describes how they are created, implemented and other details.