Commit 84276de
test: increase test coverage (#51)
## 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.
* Fixes
[#254](https://app.zenhub.com/workspaces/metamask-accounts-team-v2-64c91cbeaa9d1c00126621fd/issues/gh/metamask/accounts-planning/254)
* See:
[#244](https://app.zenhub.com/workspaces/metamask-accounts-team-v2-64c91cbeaa9d1c00126621fd/issues/gh/metamask/accounts-planning/244)
## Pre-requisites
- [ ] https://github.com/MetaMask/accounts-planning/issues/308
* [x] MetaMask/eth-snap-keyring#231
* [ ] https://github.com/MetaMask/accounts-planning/issues/307
## 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
```plaintext
---------------------|---------|----------|---------|---------|-------------------------
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
---------------------|---------|----------|---------|---------|-------------------------
---------
Co-authored-by: Gustavo Antunes <17601467+gantunesr@users.noreply.github.com>1 parent f404b32 commit 84276de
File tree
10 files changed
+663
-46
lines changed- packages
- site
- src/pages
- snap
- src
- utils
10 files changed
+663
-46
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
3 | 7 | | |
4 | 8 | | |
5 | 9 | | |
| |||
99 | 103 | | |
100 | 104 | | |
101 | 105 | | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
102 | 110 | | |
103 | 111 | | |
104 | | - | |
| 112 | + | |
105 | 113 | | |
106 | 114 | | |
107 | 115 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
13 | 20 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
| 43 | + | |
| 44 | + | |
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
| |||
86 | 87 | | |
87 | 88 | | |
88 | 89 | | |
| 90 | + | |
89 | 91 | | |
90 | 92 | | |
91 | 93 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| |||
0 commit comments