Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: increase test coverage #51

Merged
merged 79 commits into from
Mar 12, 2024
Merged

test: increase test coverage #51

merged 79 commits into from
Mar 12, 2024

Conversation

k-g-j
Copy link
Contributor

@k-g-j k-g-j commented Feb 22, 2024

Description

PR adds more unit tests for specific flows and error messages with the keyring.ts file. There is a minor refactor in the createAccount method to check for duplicate accounts.

Pre-requisites

Test Coverage Report

Summary

The test coverage has been updated as part of the efforts to increase the code coverage for the snap-account-abstraction-keyring module. The tests were executed with yarn test:coverage --no-cache, ensuring that cached results did not influence the outcomes. The coverage for the keyring.ts file is now above 95%.

  • Test Suites: 1 passed, 1 total
  • Tests: 35 passed, 35 total

Coverage Overview

---------------------|---------|----------|---------|---------|-------------------------
File                 | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s       
---------------------|---------|----------|---------|---------|-------------------------
All files            |   87.58 |    60.63 |   82.45 |   87.75 |                         
 snap                |     100 |      100 |     100 |     100 |                         
  hardhat.config.ts  |     100 |      100 |     100 |     100 |                         
 snap/src            |   92.34 |    67.74 |    87.5 |   92.26 |                         
  keyring.ts         |   95.67 |    67.92 |     100 |   95.62 | 195,443-445,547-549,562 
  logger.ts          |      75 |    57.14 |   55.55 |      75 | 64,81-92,112-122        
  permissions.ts     |     100 |      100 |     100 |     100 |                         
  stateManagement.ts |    62.5 |      100 |      50 |    62.5 | 18-25                   
 snap/src/constants  |   93.75 |        0 |     100 |   93.75 |                         
  aa-factories.ts    |     100 |      100 |     100 |     100 |                         
  chain-ids.ts       |     100 |      100 |     100 |     100 |                         
  chainConfig.ts     |     100 |      100 |     100 |     100 |                         
  dummy-values.ts    |   88.88 |        0 |     100 |   88.88 | 15                      
  entrypoints.ts     |     100 |      100 |     100 |     100 |                         
 snap/src/utils      |      72 |    42.85 |   68.75 |    72.6 |                         
  ecdsa.ts           |     100 |      100 |     100 |     100 |                         
  util.ts            |   43.33 |        0 |      50 |   42.85 | 15-27,37-49,105         
  validation.ts      |   89.47 |       80 |     100 |   89.47 | 49,81-84,88             
---------------------|---------|----------|---------|---------|-------------------------

k-g-j and others added 30 commits February 13, 2024 17:10
owencraston
owencraston previously approved these changes Mar 5, 2024
@k-g-j k-g-j changed the title feat: increase test coverage test: increase test coverage Mar 5, 2024
packages/snap/src/keyring.ts Outdated Show resolved Hide resolved
packages/snap/src/keyring.ts Outdated Show resolved Hide resolved
packages/site/src/pages/index.tsx Outdated Show resolved Hide resolved
packages/snap/src/keyring.test.ts Outdated Show resolved Hide resolved
packages/snap/src/keyring.test.ts Outdated Show resolved Hide resolved
packages/snap/src/keyring.test.ts Outdated Show resolved Hide resolved
packages/snap/src/keyring.test.ts Outdated Show resolved Hide resolved
packages/snap/src/keyring.test.ts Outdated Show resolved Hide resolved
@k-g-j k-g-j force-pushed the feat/increase-test-coverage branch from 666d687 to 866b34c Compare March 6, 2024 16:10
Copy link

socket-security bot commented Mar 6, 2024

New dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/[email protected] Transitive: environment, eval, filesystem, network, shell, unsafe +298 523 MB simenb

View full report↗︎

packages/snap/src/keyring.ts Outdated Show resolved Hide resolved
packages/snap/src/keyring.ts Outdated Show resolved Hide resolved
packages/snap/src/keyring.test.ts Outdated Show resolved Hide resolved
packages/snap/src/keyring.test.ts Outdated Show resolved Hide resolved
packages/snap/src/utils/caip.ts Show resolved Hide resolved
Copy link

socket-security bot commented Mar 7, 2024

👍 Dependency issues cleared. Learn more about Socket for GitHub ↗︎

This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.

Ignoring: npm/[email protected]

View full report↗︎

Next steps

Take a deeper look at the dependency

Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support [AT] socket [DOT] dev.

Remove the package

If you happen to install a dependency that Socket reports as Known Malware you should immediately remove it and select a different dependency. For other alert types, you may may wish to investigate alternative packages or consider if there are other ways to mitigate the specific risk posed by the dependency.

Mark a package as acceptable risk

To ignore an alert, reply with a comment starting with @SocketSecurity ignore followed by a space separated list of ecosystem/package-name@version specifiers. e.g. @SocketSecurity ignore npm/[email protected] or ignore all packages with @SocketSecurity ignore-all

@k-g-j
Copy link
Contributor Author

k-g-j commented Mar 7, 2024

@SocketSecurity ignore npm/[email protected]

packages/snap/src/keyring.ts Outdated Show resolved Hide resolved
packages/snap/src/keyring.test.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@ccharly ccharly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for all those changes 😄

@k-g-j k-g-j merged commit 84276de into main Mar 12, 2024
11 checks passed
@k-g-j k-g-j deleted the feat/increase-test-coverage branch March 12, 2024 13:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants