Skip to content

chore: Add autoSign unit test to validate no call unless using ledger/QR#26725

Merged
Cal-L merged 1 commit into
mainfrom
chore/MCWP-372-auto-sign-unit-tests
Mar 2, 2026
Merged

chore: Add autoSign unit test to validate no call unless using ledger/QR#26725
Cal-L merged 1 commit into
mainfrom
chore/MCWP-372-auto-sign-unit-tests

Conversation

@Cal-L

@Cal-L Cal-L commented Feb 28, 2026

Copy link
Copy Markdown
Contributor

Description

Adds a unit test for autoSign to validate that it does NOT get called unless using Ledger or QR account. This is an action item from the security team - https://docs.google.com/document/d/1yoaOLqVh0_WXxq3dGqi0dVFnMWaK05dhXYxFgvSOQvQ/edit?tab=t.0#heading=h.ngbwex5oz6hk

Changelog

CHANGELOG entry:

Related issues

Fixes: https://consensyssoftware.atlassian.net/browse/MCWP-372

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

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
Test-only changes that add coverage around autoSign early-return behavior; no production logic is modified.

Overview
Adds a new unit test ensuring autoSign does nothing (no navigation and no getDeviceId call) when the transaction from address is not a Ledger/QR hardware account.

Refactors the existing Jest mocks for isHardwareAccount and getDeviceId to use reusable mock functions (mockIsHardwareAccount, mockGetDeviceId) so tests can override behavior and assert invocation.

Written by Cursor Bugbot for commit 45715ce. This will update automatically on new commits. Configure here.

@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.

@metamaskbot metamaskbot added the team-mobile-platform Mobile Platform team label Feb 28, 2026
@Cal-L Cal-L added No QA Needed Apply this label when your PR does not need any QA effort. no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed no changelog required No changelog entry is required for this change needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) labels Feb 28, 2026
@github-project-automation github-project-automation Bot moved this to Needs dev review in PR review queue Feb 28, 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: 95%
click to see 🤖 AI reasoning details

E2E Test Selection:
The change is purely to a unit test file (RootRPCMethodsUI.test.js) with no modifications to production code. The changes:

  1. Refactor mock functions (mockIsHardwareAccount, mockGetDeviceId) to module scope for better test control
  2. Add a new test case for the autoSign function verifying it doesn't navigate when the account is not a hardware wallet (Ledger/QR)
  3. Reset mock implementations in beforeEach

Since no production code is modified, there's no risk to user-facing functionality and no E2E tests are needed to validate these changes. The unit tests themselves will validate the test logic during the CI unit test phase.

Performance Test Selection:
No performance tests needed. This is a unit test file change only - no production code is modified that could impact app performance.

View GitHub Actions results

@Cal-L Cal-L enabled auto-merge March 2, 2026 17:13
@Cal-L Cal-L added this pull request to the merge queue Mar 2, 2026
@github-project-automation github-project-automation Bot moved this from Needs dev review to Review finalised - Ready to be merged in PR review queue Mar 2, 2026
Merged via the queue into main with commit 3dbf1fa Mar 2, 2026
97 checks passed
@Cal-L Cal-L deleted the chore/MCWP-372-auto-sign-unit-tests branch March 2, 2026 17:41
@github-project-automation github-project-automation Bot moved this from Review finalised - Ready to be merged to Merged, Closed or Archived in PR review queue Mar 2, 2026
@github-actions github-actions Bot removed the needs-dev-review PR needs reviews from other engineers (in order to receive required approvals) label Mar 2, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 2, 2026
@metamaskbot metamaskbot added the release-7.69.0 Issue or pull request that will be included in release 7.69.0 label Mar 2, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

no changelog required No changelog entry is required for this change No QA Needed Apply this label when your PR does not need any QA effort. no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed release-7.69.0 Issue or pull request that will be included in release 7.69.0 size-S team-mobile-platform Mobile Platform team

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants