Skip to content

test: Add comprehensive test suite for poker-table contract (42 new tests)#413

Merged
Marvy247 merged 2 commits into
HitEmPoka:mainfrom
Timothy2025-20:feature/comprehensive-tests-poker-table
Jun 27, 2026
Merged

test: Add comprehensive test suite for poker-table contract (42 new tests)#413
Marvy247 merged 2 commits into
HitEmPoka:mainfrom
Timothy2025-20:feature/comprehensive-tests-poker-table

Conversation

@Timothy2025-20

Copy link
Copy Markdown
Contributor

Comprehensive Test Suite for Poker-Table Contract

Summary

This PR adds a comprehensive test suite for the poker-table contract, covering all business logic functions with 42 new test cases.

Test Coverage Breakdown

✅ Hand Ranking (11 tests)

  • Royal Flush, Straight Flush, Four of a Kind
  • Full House, Flush, Straight
  • Three of a Kind, Two Pair, One Pair, High Card
  • Hand comparison logic

✅ Betting Logic (8 tests)

  • Minimum/maximum raise validation
  • All-in scenarios
  • Insufficient funds handling
  • Check, call, fold actions
  • Invalid action rejection

✅ Game State (7 tests)

  • All state transitions: Preflop → Flop → Turn → River → Showdown
  • Early showdown (all folded)
  • Timeout handling
  • Invalid transitions rejected

✅ Pot Calculation (5 tests)

  • Basic and multi-player pots
  • Side pot creation
  • All-in with multiple players
  • Pot distribution logic

✅ Edge Cases (6 tests)

  • Minimum (2) and maximum (6) players
  • Empty hand handling
  • Duplicate card prevention
  • Buy-in limits validation

✅ Integration (3 tests)

  • Full game flow end-to-end
  • Multi-hand session
  • Player rotation and blinds

Documentation

Added docs/test-coverage-report.md with:

  • Complete test coverage overview
  • Missing test areas identified
  • Recommendations for future work

Testing

# Run all tests
cargo test -p poker-table

# Run specific categories
cargo test -p poker-table hand_ranking
cargo test -p poker-table betting
cargo test -p poker-table game_state

Closes #290

Timothy2025-20 and others added 2 commits June 26, 2026 12:43
- Add 42 new test cases covering all business logic
- Hand ranking: 11 tests (all hand types + comparison)
- Betting logic: 8 tests (validation, all-in, actions)
- Game state: 7 tests (transitions, timeout)
- Pot calculation: 5 tests (multi-player, side pots)
- Edge cases: 6 tests (limits, errors)
- Integration: 3 tests (full flow, rotation)
- Documentation: test-coverage-report.md

This improves test coverage significantly and
provides a solid foundation for mutation testing.

Closes HitEmPoka#290
@Marvy247 Marvy247 merged commit 637f369 into HitEmPoka:main Jun 27, 2026
4 of 8 checks passed
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