All our tests are all located inside test.js.
They can be run with:
cd web npm test
The dynamic website tests also uses Mocha just like the tests for OurBigBook CLI and OurBigBook Library, so similar usage patterns apply, e.g. to run just a single test:
or to show database queries being done in the tests:
npm test -- -g 'substring of test title'
DEBUG='*:sql:*' npm test
The tests include two broad classes of tests:
- API tests: launch the server on a random port, and run API commands, thus testing the entire backend
- smaller unit tests that only call certain functions directly
- TODO: create frontend tests: github.com/cirosantilli/node-express-sequelize-nextjs-realworld-example-app/issues/11