question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

test(common): increase test coverage

See original GitHub issue

Description

As a community member of Cactus I want to feel good about using software that has good test coverage so that I can sleep a little bit better (not much because severe bugs can still lurk in codebases with 100% test coverage, but nevertheless…)

Currently if you run the test command for the common package (see below) then you get a coverage report is is mostly in the red. The idea for this issue is to turn that green.

Execute the tests of the common package

npx tap --jobs=1 --timeout=60 "packages/cactus-common/src/test/typescript/{unit,integration}/"

The report at the end of the test execution:

Suites:   5 passed, 5 of 5 completed
Asserts:  47 passed, of 47
Time:     10s
--------------------------|----------|----------|----------|----------|-------------------|
File                      |  % Stmts | % Branch |  % Funcs |  % Lines | Uncovered Line #s |
--------------------------|----------|----------|----------|----------|-------------------|
All files                 |    82.51 |    67.61 |       50 |    82.35 |                   |
 main/typescript          |    86.01 |    72.88 |    52.94 |    86.15 |                   |
  bools.ts                |       50 |        0 |        0 |       50 |                13 |
  checks.ts               |       40 |        0 |        0 |       40 |          16,17,18 |
  coded-error.ts          |       20 |        0 |        0 |       25 |            7,8,12 |
  js-object-signer.ts     |    96.77 |    91.67 |      100 |    96.77 |                34 |
  key-converter.ts        |      100 |    96.15 |      100 |      100 |                83 |
  objects.ts              |     62.5 |    77.78 |       50 |    66.67 |    57,58,59,60,63 |
  public-api.ts           |      100 |      100 |    36.36 |      100 |                   |
  secp256k1-keys.ts       |      100 |      100 |      100 |      100 |                   |
  strings.ts              |    28.57 |        0 |        0 |    28.57 |     9,13,17,18,19 |
 main/typescript/logging  |     69.7 |    41.67 |    42.86 |     69.7 |                   |
  logger-provider.ts      |    71.43 |    42.86 |    33.33 |    71.43 |       26,27,28,29 |
  logger.ts               |    68.42 |       40 |    45.45 |    68.42 | 46,50,54,58,61,67 |
 test/typescript/fixtures |    71.43 |      100 |       50 |    71.43 |                   |
  dummy-classes.ts        |    71.43 |      100 |       50 |    71.43 |             11,24 |
--------------------------|----------|----------|----------|----------|-------------------|

Acceptance Criteria

  1. The first line (All files) is all green meaning that it’s above threshold (I think the limit for green is 85% but not a 100% sure on that)
  2. Tests added use the tape library (not tap)
  3. Tests added follow the existing conventions

cc: @jonathan-m-hamilton

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:21 (20 by maintainers)

github_iconTop GitHub Comments

1reaction
petermetzcommented, Nov 30, 2020

Done, I accepted the corrections and changed the package to uuid, I will do a pr. Thanks for all the help and sorry for the delay.

@gabrielsoaresm94 No problem at all. Thank you for the contribution! Looking forward to the PR!

1reaction
petermetzcommented, Nov 20, 2020

@petermetz Got it, all right then. It was good to work with you, thanks for the opportunity. I just need to do PR?

@gabrielsoaresm94 Depends, have you addressed this? =>

So I’m totally fine with skipping the tests for the logger for now, the rest of it looks more or less okay with a few nits like using the uuid library instead of uuidv4 and then import the v4 function like this: import { v4 as uuidv4 } from “uuid”;.

Read more comments on GitHub >

github_iconTop Results From Across the Web

4 Steps to Improve Your Test Coverage | SmartBear
What is Test Coverage? · #1 Create a Plan and Set a Goal · #2 Increase Code Coverage · #3 Enhance Test Automation...
Read more >
How to increase Test Coverage for Mobile and Web Apps
1. Use Automation Tools and Frameworks ... Software test automation is no longer a hidden method for achieving faster coverage. Test automation ...
Read more >
How to Achieve more Test Coverage in Less Time?
It is a practice to improve software quality. Test coverage helps the testers to improve the quality of test cases that covers the...
Read more >
Test Coverage in Software Testing (Tips to Maximize Testing ...
Test coverage helps monitor the quality of testing, and assists testers to create tests that cover areas that are missing or not validated. ......
Read more >
Test Coverage in Software Testing - Guru99
In software testing, test coverage measures the amount of testing performed ... Helps to create additional test cases to increase coverage ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found