Add unit test and code coverage
Closed this issue · 3 comments
yzhu27 commented
Unit test and code coverage is required for more stable performance
yzhu27 commented
Added unit tests for functions:
- addListPriceTips
- harrisConverter
- costcoConverter
GitHub Action is enabled for automatically run unit tests when push.
yzhu27 commented
Current code coverage:
21 passing (155ms)
-------------------|---------|----------|---------|---------|-----------------------------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
-------------------|---------|----------|---------|---------|-----------------------------------------
All files | 70.92 | 53.96 | 44.44 | 69.4 |
content_script.js | 70.92 | 53.96 | 44.44 | 69.4 | 57-61,89-95,108-165,172-173,259,266,288
-------------------|---------|----------|---------|---------|-----------------------------------------
Since some functions requires specific browser environment and domain to operate, it is too difficult to simulate and implement unit tests for them, future enhancement required.
yzhu27 commented
Current code coverage:
-------------------|---------|----------|---------|---------|-------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
-------------------|---------|----------|---------|---------|-------------------
All files | 94.89 | 81.66 | 88.88 | 94.81 |
content_script.js | 94.89 | 81.66 | 88.88 | 94.81 | 71-75,103,164
-------------------|---------|----------|---------|---------|-------------------
Specific Lines is unreachable now, but total coverage meets requirement.