Skip to content

chore: revert account utils test changes perps#29503

Open
tommasini wants to merge 1 commit intomainfrom
fix/revert-test-changes-perps-accountUtils
Open

chore: revert account utils test changes perps#29503
tommasini wants to merge 1 commit intomainfrom
fix/revert-test-changes-perps-accountUtils

Conversation

@tommasini
Copy link
Copy Markdown
Contributor

@tommasini tommasini commented Apr 29, 2026

Description

Changelog

CHANGELOG entry:

Related issues

Fixes:

Manual testing steps

Feature: my feature name

  Scenario: user [verb for user action]
    Given [describe expected initial app state]

    When user [verb for user action]
    Then [describe expected outcome]

Screenshots/Recordings

Before

After

Pre-merge author checklist

Performance checks (if applicable)

  • I've tested on Android
    • Ideally on a mid-range device; emulator is acceptable
  • I've tested with a power user scenario
    • Use these power-user SRPs to import wallets with many accounts and tokens
  • I've instrumented key operations with Sentry traces for production performance metrics

For performance guidelines and tooling, see the Performance Guide.

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Note

Low Risk
Low risk because this PR only changes test assertions and does not modify runtime perps/account logic.

Overview
Aligns addSpotBalanceToAccountState test coverage so that when spot collateral is effectively zero (no USDC, USDH-only, or empty balances), totalBalance/availableBalance are preserved and availableToTradeBalance is expected to default to availableBalance.

Renames the zero-spot test to explicitly assert numeric fields are preserved and availableToTradeBalance is set consistently.

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

@tommasini tommasini requested a review from a team as a code owner April 29, 2026 16:11
@github-actions
Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@metamaskbotv2 metamaskbotv2 Bot added the team-mobile-platform Mobile Platform team label Apr 29, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: None (no tests recommended)
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: low
  • AI Confidence: 97%
click to see 🤖 AI reasoning details

E2E Test Selection:
The only changed file is app/controllers/perps/utils/accountUtils.test.ts, which is a unit test file. The changes are purely test assertion updates:

  1. Two test cases update their assertions from hardcoded values ('50', '0') to use accountState.totalBalance and accountState.availableBalance references, reflecting corrected expected behavior.
  2. One test is renamed for clarity.
  3. One test adds more granular field-level assertions instead of using objectContaining.

No production code is modified. No E2E flows, UI components, controllers, or shared infrastructure are affected. This change only affects Jest unit tests, not Detox E2E tests. There is no performance impact whatsoever. No E2E tags or performance test tags are warranted.

Performance Test Selection:
Only a unit test file was modified with updated assertions. No production code, UI components, or performance-sensitive paths were changed. No performance tests are needed.

View GitHub Actions results

@sonarqubecloud
Copy link
Copy Markdown

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

Labels

size-S team-mobile-platform Mobile Platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants