Add and extend unit tests across SDK packages#313
Conversation
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #313 +/- ##
==========================================
+ Coverage 79.75% 79.77% +0.01%
==========================================
Files 83 84 +1
Lines 1309 1310 +1
Branches 160 217 +57
==========================================
+ Hits 1044 1045 +1
+ Misses 265 259 -6
- Partials 0 6 +6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
- precompiles: add addresses.spec.ts validating all 12 precompile addresses are valid 42-char Ethereum addresses, unique, and in the reserved range; add abis.spec.ts validating each ABI has expected named functions, correct entry structure, and is non-empty - registry: extend networks, ibc, gas, and tokens tests with URL format validation, channel-N pattern checks, positive gas price assertions, and https image URL checks - create-sei: add templates.test.ts verifying template and extension directory structure, package.json validity, and tsconfig presence - sei-global-wallet: add config.spec.ts validating walletName, walletUrl, environmentId, rdns pattern, and walletIcon data URI - ledger: extend seiLedgerOfflineAminoSigner.spec.ts with BIP44 derivation path pattern tests Also revert planning/doc files added during exploration that are out of scope for this branch.
PR SummaryLow Risk Overview Extends existing Reviewed by Cursor Bugbot for commit 02d84ca. Bugbot is set up for automated code reviews on this repo. Configure here. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 3 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 02d84ca. Configure here.
| ['POINTERVIEW', POINTERVIEW_PRECOMPILE_ABI, ['getCW20Pointer', 'getCW721Pointer']], | ||
| ['STAKING', STAKING_PRECOMPILE_ABI, ['delegate', 'undelegate', 'redelegate', 'delegation']], | ||
| ['WASM', WASM_PRECOMPILE_ABI, ['execute', 'execute_batch']] | ||
| ]; |
There was a problem hiding this comment.
SOLO precompile omitted from function name tests
Low Severity
SOLO_PRECOMPILE_ABI is included in ALL_ABIS for top-level structure tests but is missing from the PRECOMPILE_ABIS array used for function name validation. The SOLO ABI has two functions (claim and claimSpecific) whose names are never checked, unlike every other precompile. This appears to be an accidental omission since SOLO is consistently included in every other test list in the PR.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 02d84ca. Configure here.
| expect(info.min_gas_price).toBeGreaterThan(0); | ||
| if (info.min_gas_price <= 0) { | ||
| throw new Error(`Network ${network} has non-positive min_gas_price: ${info.min_gas_price}`); | ||
| } |
There was a problem hiding this comment.
Unreachable throw statements after Jest expect assertions
Low Severity
Several tests follow an expect() assertion with an if check and throw new Error(...) meant to provide a better error message. This code is unreachable: if the expect passes, the if condition is false; if expect fails, Jest throws before reaching the if. The same pattern appears in gas, ibc, networks, and tokens test files.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit 02d84ca. Configure here.
| ['JSON', JSON_PRECOMPILE_ABI, ['extractAsBytes', 'extractAsBytesList']], | ||
| ['ORACLE', ORACLE_PRECOMPILE_ABI, ['getExchangeRates', 'getOracleTwaps']], | ||
| ['POINTER', POINTER_PRECOMPILE_ABI, ['addCW20Pointer', 'addCW721Pointer', 'addNativePointer']], | ||
| ['POINTERVIEW', POINTERVIEW_PRECOMPILE_ABI, ['getCW20Pointer', 'getCW721Pointer']], |
There was a problem hiding this comment.
POINTERVIEW test omits getNativePointer from expected functions
Low Severity
The POINTERVIEW entry in PRECOMPILE_ABIS only lists ['getCW20Pointer', 'getCW721Pointer'] as expected functions, but POINTERVIEW_PRECOMPILE_ABI actually contains a third function, getNativePointer. The test only verifies that listed functions are present (not that all functions are listed), so this silently skips validation of getNativePointer.
Reviewed by Cursor Bugbot for commit 02d84ca. Configure here.


Summary
Adds new test files and extends existing ones across five packages to improve coverage of core SDK exports.
New test files:
packages/precompiles/src/precompiles/__tests__/addresses.spec.ts— validates all 12 precompile address constants are valid 42-character Ethereum addresses, all unique, and within the reserved precompile address rangepackages/precompiles/src/precompiles/__tests__/abis.spec.ts— validates each ABI contains the expected named functions, every function entry hasinputs/outputs/stateMutability, and no ABI is emptypackages/create-sei/src/templates.test.ts— verifies template and extension directory structure,package.jsonvalidity,tsconfig.jsonpresence, andsrc/directory existencepackages/sei-global-wallet/src/lib/__tests__/config.spec.ts— validateswalletName,walletUrl(https),environmentId,eip6963.rdnspattern, andwalletIcondata URIExtended test files:
packages/registry/src/networks/__tests__/index.spec.ts— adds RPC URL scheme validation (https://orwss://) and non-empty provider name checkspackages/registry/src/ibc/__tests__/index.spec.ts— addschannel-\d+pattern validation for allsrc_channelanddst_channelvalues across all networkspackages/registry/src/gas/__tests__/index.spec.ts— adds positivemin_gas_priceassertion anduseidenom check across all networkspackages/registry/src/tokens/__tests__/index.spec.ts— addshttps://scheme validation for all token image URLspackages/ledger/src/cosmos/__tests__/seiLedgerOfflineAminoSigner.spec.ts— adds BIP44 derivation path pattern tests and verifies paths are forwarded correctly to the underlying appTest plan
pnpm test:allpasses with all 565 tests green across 6 packages