alphagov / calculators

Serves the Child benefit tax calculator on GOV.UK
https://docs.publishing.service.gov.uk/apps/calculators.html
MIT License
11 stars 13 forks source link

Create test-dependencies.js to replace live static assets #900

Closed kevindew closed 4 years ago

kevindew commented 4 years ago

Trello: https://trello.com/c/oNEtjIVp/99-serve-static-assets-from-www-hostname

The tests for this app were failing after GOV.UK's assets switched from the assets hostname to www. This was because slimmer was actually embedding links to production GOV.UK assets which were symlinked to the latest ones. Once the assets changed path then the tests broke.

Since it is good practice for tests to be isolated I've created a test-dependencies.js file which loads in the basic slimmer dependencies from govuk_publishing_components. This has the advantage that this test suite no longer has external network requirement, but does have the disadvantage that the JS isn't the same. This trade-off seems reasonable since there was never anything particularly realistic about the slimmer test template 1 and it's mostly luck that it matches production.