Closed eamon0989 closed 1 year ago
CI is running/has finished running commands for commit 376c1518e26ed047a6bd379ebea347cb0daa859d. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.
π See all runs for this branch
Sent with π from NxCloud.
Messages | |
---|---|
:book: | :thumbsup: You ticked most of the checkboxes! |
Generated by :no_entry_sign: dangerJS against 376c1518e26ed047a6bd379ebea347cb0daa859d
Kudos, SonarCloud Quality Gate passed!
Description
This PR is a major refactor of both the
generate-html
andgenerate-pdf
test suites. Our test suites had a limitation that meant only onevalid_cert.json
could be tested per version. This PR allows for multiple certificate fixtures to be used and tested. The approach I have used allows for the first certificate to be namedvalid_cert.json
and for any subsequent certificates to be numbered, e.g.valid_cert_1.json
,valid_cert_1.pdf
, etc.I have also renamed
template_hbs.html
tovalid_cert.html
to keep it inline with thejson
andpdf
files.I noticed that a huge portion of the test files was just passing in filepaths, and because we have a pattern that never changes, this allows the filepaths to be generated dynamically, cutting out a lot of boilerplate. To accomplish this, the html partials have been moved to their own file in the relevant fixture versions.
I have also added tests for the rendering of the Chinese fonts in PDF, the font files are stored in
fixtures/fonts
. Installing them as a devDependency is also a possibility, but I chose to add the files directly as only 3 are needed, and a lot more are installed when installing a package. They should not affect package size as fixtures are not included.I also added a new script called
utils/generate-fixtures-from-json.ts
. Currently adding fixtures is a very cumbersome process, involving running a command with a lot of arguments. I do it regularly and still mess up the arguments sometimes. This script is an optional way to automate that process using sensible defaults. If something more robust is needed, the individual fixture can always be created using the generate-pdf/html scripts using custom arguments.Fixes #213
Type of change
Checklist: