Skip to content

chore: add test for order book interaction#171

Merged
MicBun merged 1 commit intomainfrom
testOrderBookUtil
Jan 21, 2026
Merged

chore: add test for order book interaction#171
MicBun merged 1 commit intomainfrom
testOrderBookUtil

Conversation

@MicBun
Copy link
Copy Markdown
Member

@MicBun MicBun commented Jan 21, 2026

resolves: https://github.com/truflation/website/issues/2979

Summary by CodeRabbit

  • Tests
    • Introduced comprehensive integration tests for order book market operations, validating creation inputs across multiple scenarios including hash validation, settlement time, spread bounds, and order size constraints.
    • Added order validation tests for buy order placement and cancellation operations, verifying parameter constraints and bounds.
    • Enhanced test utilities to return transaction response data for improved test assertion capabilities.

✏️ Tip: You can customize this high-level summary in your review settings.

@MicBun MicBun self-assigned this Jan 21, 2026
@holdex
Copy link
Copy Markdown

holdex bot commented Jan 21, 2026

Time Submission Status

Member Status Time Action Last Update
MicBun ✅ Submitted 2h Update time Jan 21, 2026, 10:00 PM

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jan 21, 2026

📝 Walkthrough

Walkthrough

This change adds integration tests for order book operations, validating market and order input parameters, and updates a test utility function to return transaction query responses for test assertions.

Changes

Cohort / File(s) Summary
Order Book Integration Tests
tests/integration/order_book_test.go
New integration test file with SDK-GO validation tests for order book operations. Includes TestOrderBookMarketValidation covering market creation input scenarios (valid input, invalid hash length, invalid settle time, spread bounds, order size), and TestOrderBookOrderValidation covering order input validation for PlaceBuyOrderInput (query ID, price bounds 1-99, amount constraints) and CancelOrderInput (price constraints).
Test Utility Updates
tests/integration/util.go
Updated waitTxToBeMinedWithSuccess function to return *kwiltypes.TxQueryResponse instead of void, enabling callers to perform further assertions on transaction responses.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 Hops through order books with glee,
Validates with eyes so keen,
Markets dance and orders sing,
Test utilities take wing,
Better coverage, clean and bright!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title 'chore: add test for order book interaction' accurately describes the main change: adding new integration tests for order book validation operations.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@MicBun MicBun merged commit b91f436 into main Jan 21, 2026
5 checks passed
@MicBun MicBun deleted the testOrderBookUtil branch January 21, 2026 22:26
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.

1 participant