FEAT: add unit tests for gaslessUtxos collection#505
Open
GabrielTozatti wants to merge 1 commit intotzt/feat/utxo-worker-schema-servicefrom
Open
FEAT: add unit tests for gaslessUtxos collection#505GabrielTozatti wants to merge 1 commit intotzt/feat/utxo-worker-schema-servicefrom
GabrielTozatti wants to merge 1 commit intotzt/feat/utxo-worker-schema-servicefrom
Conversation
guimroque
reviewed
Mar 11, 2026
guimroque
reviewed
Mar 11, 2026
guimroque
reviewed
Mar 11, 2026
Member
guimroque
left a comment
There was a problem hiding this comment.
Code Review
Summary
This PR adds comprehensive unit tests for the gaslessUtxos collection, covering all CRUD operations and concurrency scenarios. The implementation uses mongodb-memory-server for isolated testing and includes proper race condition testing for the reservation system.
Strengths
- Excellent race condition testing in gaslessUtxos.test.ts:89-107 - properly validates atomic operations
- Clean test environment setup with proper lifecycle management in gaslessTestEnvironment.ts:10-25
- Comprehensive edge case coverage including null returns and expired reservation handling
- Good use of afterEach hooks for test isolation and cleanup
Issues
- 0 critical, 1 important, 1 suggestion
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Implements unit tests for the UTXO pool collection covering all operations and concurrency scenarios.
Summary
GaslessTestEnvironmentsetup utility withmongodb-memory-serverfor in-memory MongoDBfindAvailable()— 2 scenariosreserve()— 5 scenarios including race conditionsrelease()— 3 scenariosmarkSpent()— 3 scenariosgetStats()— 2 scenariosreleaseExpired()— 4 scenariosmongodb-memory-serveras dev dependency for in-memory MongoDB in teststsconfig-pathsas dev dependency for path resolution in testsChecklist