Skip to content

test: increase unit test coverage for bridge-status-controller#8186

Merged
micaelae merged 6 commits intomainfrom
swaps4229-refactor-bridge-status-test-coverage
Mar 12, 2026
Merged

test: increase unit test coverage for bridge-status-controller#8186
micaelae merged 6 commits intomainfrom
swaps4229-refactor-bridge-status-test-coverage

Conversation

@micaelae
Copy link
Member

@micaelae micaelae commented Mar 11, 2026

Explanation

Adding unit tests to bump the test coverage of the bridge-status-controller and bridge-status-controller.intent modules to 100%. This is a prep step for the upcoming submitTx refactor to ensure existing functionality is preserved

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

Medium Risk
Mostly test/mocking changes, but it also tweaks transaction submission/polling behavior (intent API typing, approval handling, and txFee conversion), which could affect swap/bridge execution paths if edge cases are missed.

Overview
Raises bridge-status-controller test coverage to 100% by adding extensive unit tests and new snapshots around intent polling/syncing and EVM submitTx scenarios (gas-included fees, 7702 batch path precedence, approvals/gasless swaps).

Includes small functional hardening/refactors to support the tests: intent API and IntentManager now use typed BridgeClientId and numeric ChainId, approval handling only processes EVM approval data and can require explicit approval confirmation for mobile hardware wallets, gas fee selection uses quote txFee values directly (no ?? 0 fallback), and bridge-status validation failure attribution is simplified. Coverage thresholds were tightened/enforced in jest.config.js, and the changelog was updated.

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

@micaelae micaelae requested a review from a team as a code owner March 11, 2026 19:59
@micaelae micaelae marked this pull request as draft March 11, 2026 19:59
Copy link

@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 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

@micaelae micaelae force-pushed the swaps4229-refactor-bridge-status-test-coverage branch from bd27c27 to 2922251 Compare March 11, 2026 21:19
@micaelae micaelae marked this pull request as ready for review March 11, 2026 21:36
@micaelae micaelae requested a review from a team as a code owner March 11, 2026 21:36
@micaelae micaelae enabled auto-merge March 11, 2026 21:36
error.failures().forEach(({ branch, path }) => {
error.failures().forEach(({ path }) => {
const aggregatorId =
branch?.[0]?.quote?.bridgeId ??
Copy link
Member Author

Choose a reason for hiding this comment

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

These lines don't apply to statuses because they don't have a quote field

clientId: string,
): Promise<IntentOrder> {
clientId: BridgeClientId,
): Promise<IntentStatusResponse> {
Copy link
Member Author

Choose a reason for hiding this comment

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

Renamed the intent order response type to align with getTxStatus's, and also narrowed types for the function params

const requireApproval =
isHardwareAccount && this.#clientId === BridgeClientId.MOBILE;
// Handle approval silently for better UX in intent flows
const approvalTxMeta = await this.#handleApprovalTx(
Copy link
Member Author

Choose a reason for hiding this comment

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

handleApprovalTx does the approval check so removing the parent if statement

@micaelae micaelae added this pull request to the merge queue Mar 12, 2026
Merged via the queue into main with commit a618f17 Mar 12, 2026
322 checks passed
@micaelae micaelae deleted the swaps4229-refactor-bridge-status-test-coverage branch March 12, 2026 16:16
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