Skip to content

Add comprehensive integration tests for Bridge quote fetching system#25

Open
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
devin/1760111390-bridge-integration-tests
Open

Add comprehensive integration tests for Bridge quote fetching system#25
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
devin/1760111390-bridge-integration-tests

Conversation

@devin-ai-integration
Copy link
Copy Markdown

Add comprehensive integration tests for Bridge quote fetching system

Summary

This PR adds a comprehensive integration test suite for the Bridge quote fetching system, covering cross-chain transaction flows, quote validation, timeout handling, and error scenarios with external bridge providers. The tests validate the end-to-end behavior of the useBridgeQuoteRequest and useBridgeQuoteData hooks working together with the Bridge controller.

Key test coverage:

  • Cross-chain flows: EVM↔Solana and EVM↔EVM transaction scenarios with proper wallet address handling
  • Quote validation: Invalid inputs, zero amounts, insufficient balance scenarios
  • Timeout/debounce: Multiple rapid requests, loading states, and debounce coalescing
  • Error handling: Network failures, provider timeouts, invalid responses, and error recovery
  • Quote lifecycle: Refresh logic, expiration handling, and complete fetch-to-display flow
  • State transitions: Loading → Fetched → Error → Retry scenarios

The test suite includes 21 test cases organized into 6 logical groups, all passing successfully.

Review & Testing Checklist for Human

3 items - Medium risk areas to validate

  • Verify mock accuracy: Review that the mocked BridgeController.updateBridgeQuoteRequestParams calls and state transitions match the real implementation behavior, especially for cross-chain scenarios
  • Test the integration tests: Run the test suite locally (yarn test:unit) and verify they can catch real bugs by temporarily breaking the implementation
  • Cross-chain logic validation: Manually verify the EVM↔Solana wallet address handling logic matches the actual bridge flow requirements in the app

Notes

  • Integration tests are placed in new __tests__/integration/ directory following standard testing conventions
  • Tests use existing utilities (createBridgeTestState, renderHookWithProvider) and mock data for consistency
  • All lint and TypeScript checks pass with no new issues introduced
  • Tests complement existing unit tests by focusing on hook interactions and state transitions

Requested by: mason.batchelor@cognition.ai (@mbatchelor81)
Link to Devin run: https://app.devin.ai/sessions/236a41a40168427b80497d2d2827ac34

- Created integration test suite covering cross-chain transaction flows (EVM to Solana, Solana to EVM, EVM to EVM)
- Added quote validation tests for invalid inputs and insufficient balance scenarios
- Implemented timeout and debounce handling tests
- Added error scenario tests with external bridge providers
- Included quote refresh and expiration logic tests
- Added end-to-end quote fetching flow test covering complete lifecycle

All 21 test scenarios pass successfully.

Co-Authored-By: mason.batchelor@cognition.ai <masonbatchelor81@gmail.com>
@devin-ai-integration
Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

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.

0 participants