Skip to content

test: pr for tests refactor related to #355#358

Merged
gabrieledm merged 6 commits into
fix/WPN-454_transaction-gas-fee-estimation-is-inaccurate-and-incompletefrom
test/WPN-454_transaction-gas-fee-estimation-is-inaccurate-and-incomplete
Jul 14, 2026
Merged

test: pr for tests refactor related to #355#358
gabrieledm merged 6 commits into
fix/WPN-454_transaction-gas-fee-estimation-is-inaccurate-and-incompletefrom
test/WPN-454_transaction-gas-fee-estimation-is-inaccurate-and-incomplete

Conversation

@gabrieledm

@gabrieledm gabrieledm commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Explanation

Split PR for test refactor from the original one #355.

  • Update/add tests for fee calculation, transaction TRX value extraction, confirmation rendering, and insufficient-balance UI behavior.

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Low Risk
Test-only changes and minor coverage config updates; no production logic modified in this diff.

Overview
Refactors large Jest suites to avoid shared beforeEach state by introducing per-test setup helpers and stricter mocks, and adds coverage for fee UI and TRX amount parsing. Jest coverage thresholds are nudged up slightly to match the new tests.

FeeCalculatorService.test.ts drops module-level as any mocks (including TronWeb) in favor of typed partial mocks and a withFeeCalculatorService wrapper that builds a fresh service and dependencies for each case. Smart-contract simulation mocks now attach ret on a spread of the real transaction instead of minimal stub objects.

ConfirmSignTransaction / render tests use a similar withSnapContext pattern with typed SnapClient, scan, assets, and fee calculator mocks. Context fixtures include isInsufficientBalance, with new cases asserting confirm is blocked and “Insufficient funds” is shown, and that render sets isInsufficientBalance: true when TRX cannot cover value plus fees.

transaction.test.ts adds tests for getTransactionTrxValue: native transfers, smart-contract call_value, and non-TRX asset transfers returning zero.

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

@gabrieledm gabrieledm requested a review from a team as a code owner July 10, 2026 10:40
…e-and-incomplete' into test/WPN-454_transaction-gas-fee-estimation-is-inaccurate-and-incomplete
gabrieledm and others added 3 commits July 10, 2026 13:06
…e-and-incomplete' into test/WPN-454_transaction-gas-fee-estimation-is-inaccurate-and-incomplete
…e-and-incomplete' into test/WPN-454_transaction-gas-fee-estimation-is-inaccurate-and-incomplete
…e-and-incomplete' into test/WPN-454_transaction-gas-fee-estimation-is-inaccurate-and-incomplete

@taran-a taran-a left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

…e-and-incomplete' into test/WPN-454_transaction-gas-fee-estimation-is-inaccurate-and-incomplete
@gabrieledm gabrieledm merged commit 07a7f4d into fix/WPN-454_transaction-gas-fee-estimation-is-inaccurate-and-incomplete Jul 14, 2026
12 checks passed
@gabrieledm gabrieledm deleted the test/WPN-454_transaction-gas-fee-estimation-is-inaccurate-and-incomplete branch July 14, 2026 13:17
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.

2 participants