Developer Notes
Setup development environment
Install Visual Studio Code and recommended extensions.
Multiple run configs have been created to facilitate debugging server, client, test and docs.
Client certificate authentication doesn't work in client debugger
Because Vue cli webpack dev server cannot proxy passthrough HTTPS connections, client certificate authentication doesn't work in client debugger. If testing client certificate authentication in web console is needed, run npm run build
to generate prod client distribution and launch server debugger on https://localhost:3000
Automated Testing
NotifyBC uses Jest test framework bundled in NestJS. To launch test, run npm run test:e2e
. A Test launch config is provided to debug in VS Code.
Github Actions runs tests as part of the build. All test scripts should be able to run unattended, headless, quickly and depend only on local resources.
To run automated testing on Windows, Docker Desktop needs to be running.
Writing Test Specs
Thanks to supertest and MongoDB In-Memory Server, test specs can be written to cover nearly end-to-end request processing workflow (only sendMail and sendSMS need to be mocked). This allows test specs to anchor onto business requirements rather than program units such as functions or files, resulting in regression tests that are more resilient to code refactoring. Whenever possible, a test spec should be written to
- start at a processing phase as early as possible. For example, to test a REST end point, start with the HTTP user request.
- assert outcome of a processing phase as late and down below as possible - the HTTP response body/code, the database record created, for example.
- avoid asserting middleware function input/output to facilitate code refactoring.
- mock email/sms sending function (implemented by default). Inspect the input of the function, or at least assert the function has been called.
Install Docs Website
If you want to contribute to NotifyBC docs beyond simple fix ups, run
cd docs && npm install && npm run dev
If everything goes well, the last line of the output will be
> VuePress dev server listening at http://localhost:8080/NotifyBC/
You can now browse to the local docs site http://localhost:8080/NotifyBC
Publish Version Checklist
- update version in package.json
- run
npm i
- globally find and replace older version number referenced in docs folder
- update version appVersion in helm/Chart.yaml (major/minor only)
- update What's new (major/minor only)
- create a new Github release