Skip to content

REFACTOR: utxo worker gasless endpoints test#511

Open
GabrielTozatti wants to merge 9 commits intotzt/feat/utxo-worker-schema-servicefrom
tzt/feat/utxo-worker-gasless-endpoints-test
Open

REFACTOR: utxo worker gasless endpoints test#511
GabrielTozatti wants to merge 9 commits intotzt/feat/utxo-worker-schema-servicefrom
tzt/feat/utxo-worker-gasless-endpoints-test

Conversation

@GabrielTozatti
Copy link
Collaborator

Description

Updates existing unit tests to reflect interface changes from the gasless endpoints implementation and adds complete flow test scenarios covering reserve, release and error cases.

Summary

  • Added estimatedMaxFee to all reserve() calls following updated ReserveUtxoOptions interface
  • Replaced total with totalValue in getStats() assertions following updated GaslessUtxoStats interface
  • Added amount explicitly to getStats() seeds to assert correct sum
  • Added owner field with default value to GaslessTestEnvironment.seed()
  • Added test for amount sum across different statuses in getStats()
  • Added complete flow test suite covering:
    • reserve -> release returning UTXO to available
    • reserve -> release -> reserve allowing UTXO reuse
    • Error: pool exhausted returns null
    • Error: insufficient UTXO amount for estimatedMaxFee returns null
    • Reserve with real wei amount using default seed value

Checklist

  • I reviewed my PR code before submitting
  • I ensured that the implementation is working correctly and did not impact other parts of the app
  • I mentioned the PR link in the task

Copy link
Member

@guimroque guimroque left a comment

Choose a reason for hiding this comment

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

Code Review

Summary

This PR adds comprehensive unit tests for the gasless UTXO worker endpoints and updates existing tests to match interface changes. The implementation includes proper HTTP controllers, error handling, and complete flow testing scenarios.

Strengths

  • Comprehensive test coverage with race condition handling in gaslessUtxos.test.ts:140-190
  • Proper error handling with custom AppError class in handleErrors.ts:3-22
  • Good separation of concerns with dedicated controller, routes, and middleware structure
  • Thorough validation of estimatedMaxFee parameter in controller.ts:16-30

Issues

  • 0 critical, 2 important, 1 suggestion

@GabrielTozatti GabrielTozatti changed the title FEAT: utxo worker gasless endpoints test REFACTOR: utxo worker gasless endpoints test Mar 12, 2026
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