Skip to content

test: validate bracket_id and round in create_match_tournament - #1890

Open
ajide00 wants to merge 1 commit into
StellarCheckMate:mainfrom
ajide00:fix/issue-1789-test-create-match-tournament-validates-bracket
Open

ajide00 wants to merge 1 commit into
StellarCheckMate:mainfrom
ajide00:fix/issue-1789-test-create-match-tournament-validates-bracket

Conversation

@ajide00

@ajide00 ajide00 commented Oct 23, 2026

Copy link
Copy Markdown

Overview

This PR adds tests for create_match_tournament covering bracket_id and round validation in the escrow contract. It asserts that duplicate bracket matches (same bracket_id + round + players) are rejected, and that a valid bracket creation succeeds and emits match/bracket_created. A new error variant is added in errors.rs to represent the duplicate-bracket rejection.

Related Issue

Changes

🧪 Match Validation Tests

  • [ADD] contracts/escrow/src/tests/match_validation.rs

    • Test: creating two matches with the same bracket_id + round + players fails.
    • Test: valid bracket creation succeeds and emits match/bracket_created.
  • [MODIFY] contracts/escrow/src/errors.rs

    • Adds the error variant returned when a duplicate bracket match is submitted, so the new test can assert on a specific error rather than a generic failure.

Verification Results

cargo test -p escrow match_validation

Both new tests exercise the duplicate-rejection path and the success/event path of create_match_tournament.

Acceptance Criteria Status
Duplicate bracket_id + round + players is rejected ✅ Covered by new test in match_validation.rs
Valid bracket creation succeeds ✅ Covered by new test in match_validation.rs
match/bracket_created event is emitted on success ✅ Asserted in new test in match_validation.rs

Closes #1789

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.

Test: create_match_tournament validates bracket_id and round fields

1 participant