Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Checklist
TODO
Description
Add
TemplateCalcService
spec testsAdd additional mock services for templateCalcService dependencies
Refactor app data
constants.ts
to shareAPP_CONFIG
via a function instead of static import as this caused issues within test environments (likely because tests don't have access todata-models
by default). Whilst it is possible to setup helpers to handle this type of case, felt easier to just call on demand as none of the tests created require the config (just contain other dependencies that reference the file in method, forcing the invocation of the static export).Initially I had hoped to setup a testing environment that would allow testing the plh_calc functions called from a templating context (e.g.
@calc(plh_add_family_member(@local.families))
, however I realised the current system isn't set up very well to support. I've added issue #2131 to suggest ways we might want to reconsider the calc system in the future.So for now this PR only adds some simple spec tests and does not provide any more advanced e2e testing
Review Notes
yarn ng test --include src\app\shared\components\template\services\template-calc.spec.ts
Dev Notes
As discussed in recent conversations linked to #2080, this provides another example of using mocked services when testing methods of a service with dependencies (in case of interest). The mocks are quite minimal, and could be expanded as we add tests for other services that require additional functionality
Git Issues
Closes #
Screenshots/Videos
If useful, provide screenshot or capture to highlight main changes