Skip to content

Add and extend unit tests across SDK packages#313

Open
monty-sei wants to merge 5 commits into
mainfrom
sdk-evm-parity
Open

Add and extend unit tests across SDK packages#313
monty-sei wants to merge 5 commits into
mainfrom
sdk-evm-parity

Conversation

@monty-sei
Copy link
Copy Markdown
Contributor

@monty-sei monty-sei commented May 14, 2026

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 range
  • packages/precompiles/src/precompiles/__tests__/abis.spec.ts — validates each ABI contains the expected named functions, every function entry has inputs/outputs/stateMutability, and no ABI is empty
  • packages/create-sei/src/templates.test.ts — verifies template and extension directory structure, package.json validity, tsconfig.json presence, and src/ directory existence
  • packages/sei-global-wallet/src/lib/__tests__/config.spec.ts — validates walletName, walletUrl (https), environmentId, eip6963.rdns pattern, and walletIcon data URI

Extended test files:

  • packages/registry/src/networks/__tests__/index.spec.ts — adds RPC URL scheme validation (https:// or wss://) and non-empty provider name checks
  • packages/registry/src/ibc/__tests__/index.spec.ts — adds channel-\d+ pattern validation for all src_channel and dst_channel values across all networks
  • packages/registry/src/gas/__tests__/index.spec.ts — adds positive min_gas_price assertion and usei denom check across all networks
  • packages/registry/src/tokens/__tests__/index.spec.ts — adds https:// scheme validation for all token image URLs
  • packages/ledger/src/cosmos/__tests__/seiLedgerOfflineAminoSigner.spec.ts — adds BIP44 derivation path pattern tests and verifies paths are forwarded correctly to the underlying app

Test plan

  • pnpm test:all passes with all 565 tests green across 6 packages

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 14, 2026

⚠️ No Changeset found

Latest commit: 02d84ca

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 14, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.77%. Comparing base (bc17ace) to head (02d84ca).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

monty-sei added 3 commits May 14, 2026 10:39
- 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.
@monty-sei monty-sei changed the title EVM standard parity Add and extend unit tests across SDK packages May 18, 2026
@monty-sei monty-sei marked this pull request as ready for review May 18, 2026 04:54
@cursor
Copy link
Copy Markdown

cursor Bot commented May 18, 2026

PR Summary

Low Risk
Low risk: changes are test-only and add stronger assertions around exported constants and config/data shape, with no runtime behavior modifications.

Overview
Adds new Jest test suites across multiple packages to validate SDK exports and package assets (create-sei template/extension structure, sei-global-wallet config fields, and precompiles ABI/address constants).

Extends existing registry and ledger tests with stricter invariants (RPC URL schemes/provider names, IBC channel ID formats, gas denom/min price constraints, token image URLs forced to https://, and BIP44 derivation path validation/forwarding).

Reviewed by Cursor Bugbot for commit 02d84ca. Bugbot is set up for automated code reviews on this repo. Configure here.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 3 potential issues.

Fix All in Cursor

❌ 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']]
];
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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)
Fix in Cursor Fix in Web

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}`);
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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)
Fix in Cursor Fix in Web

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']],
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 02d84ca. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants