Closed mattiaerre closed 6 years ago
A slightly different approach compared with #4 re how to use jest to test this component. This focuses more on unit testing 1st and code coverage so that it will be possible to refactor during a 2nd phase.
jest
Components that I'd like to have 100% covered
[X] index.js
[X] components-renderer.js
[ ] get-components-info.js
[X] sanitiser
[X] template-renderer
[X] validator
[ ] warmup
PASS __tests__/sanitiser.test.js PASS __tests__/components-renderer.test.js PASS __tests__/validator.test.js PASS __tests__/template-renderer.test.js PASS __tests__/index.test.js Test Suites: 5 passed, 5 total Tests: 31 passed, 31 total Snapshots: 21 passed, 21 total Time: 0.359s, estimated 1s Ran all test suites. ------------------------------|----------|----------|----------|----------|----------------| File | % Stmts | % Branch | % Funcs | % Lines |Uncovered Lines | ------------------------------|----------|----------|----------|----------|----------------| All files | 63.44 | 46.45 | 63.77 | 63.44 | | src | 64.73 | 46.36 | 67.92 | 64.73 | | components-renderer.js | 100 | 100 | 100 | 100 | | get-compiled-template.js | 33.33 | 0 | 25 | 33.33 |... 49,54,55,63 | get-oc-client-script.js | 71.43 | 100 | 33.33 | 71.43 | 10,13 | href-builder.js | 17.65 | 0 | 25 | 17.65 |... 72,73,74,81 | html-renderer.js | 77.78 | 50 | 50 | 77.78 | 10,27 | index.js | 100 | 100 | 100 | 100 | | process-client-responses.js | 47.06 | 21.43 | 60 | 47.06 |... 51,57,58,64 | render-components.js | 36.11 | 28.57 | 42.86 | 36.11 |... 74,77,78,80 | sanitiser.js | 100 | 100 | 100 | 100 | | settings.js | 100 | 100 | 100 | 100 | | template-renderer.js | 100 | 100 | 100 | 100 | | templates.js | 100 | 100 | 100 | 100 | | try-get-cached.js | 20 | 0 | 33.33 | 20 |... 12,13,16,17 | validator.js | 100 | 100 | 100 | 100 | | src/utils | 57.14 | 46.88 | 50 | 57.14 | | helpers.js | 48 | 43.75 | 45.45 | 48 |... 47,50,51,54 | merge-objects.js | 12.5 | 0 | 0 | 12.5 |... 13,14,15,16 | require-template.js | 82.61 | 66.67 | 100 | 82.61 | 12,32,38,47 | ------------------------------|----------|----------|----------|----------|----------------|
gonna kill this PR 👋
Description
A slightly different approach compared with #4 re how to use
jest
to test this component. This focuses more on unit testing 1st and code coverage so that it will be possible to refactor during a 2nd phase.SUT
Components that I'd like to have 100% covered
[X] index.js
[X] components-renderer.js
[ ] get-components-info.js
[X] sanitiser
[X] template-renderer
[X] validator
[ ] warmup
Report