Skip to content

Feat(testing) bus sequence expectations - #1657

Open
diiviikk5 wants to merge 2 commits into
mofa-org:mainfrom
diiviikk5:feat/testing-bus-sequence-expectations
Open

Feat(testing) bus sequence expectations #1657
diiviikk5 wants to merge 2 commits into
mofa-org:mainfrom
diiviikk5:feat/testing-bus-sequence-expectations

Conversation

@diiviikk5

Copy link
Copy Markdown
Contributor
flowchart TD
    A[Test calls send_and_capture] --> B[MockAgentBus stores sender mode message]
    B --> C[Existing test logic continues]
    C --> D[Helper reads captured_messages]
    D --> E[sender_sequence]
    D --> F[mode_sequence]
    D --> G[sender_mode_sequence]
    E --> H[has_sender_sequence expected]
    F --> I[has_mode_sequence expected]
    G --> J[has_sender_mode_sequence expected]
    H --> K[Boolean assertion in test]
    I --> K
    J --> K

Loading

closess #1656

What this PR does

This PR adds ordered sequence helpers to MockAgentBus to make routing assertions cleaner in testing scenarios where message order matters.

Added helpers

  • sender_sequence()
  • mode_sequence()
  • sender_mode_sequence()
  • has_sender_sequence(&[&str])
  • has_mode_sequence(&[CommunicationMode])
  • has_sender_mode_sequence(&[(&str, CommunicationMode)])

Added tests

New test file: tests/tests/bus_sequence_expectation_tests.rs

  • verifies sender ordering checks
  • verifies communication mode ordering checks
  • verifies combined sender+mode pair checks
  • verifies exact-length matching behavior

Why this matters

This improves deterministic, readable assertions for multi-agent communication flows and supports stronger testing-framework ergonomics without clashing with existing formatter/export PRs.

Testing

  • cargo test -p mofa-testing --test bus_sequence_expectation_tests
  • cargo test -p mofa-testing was attempted but failed in this environment due compiler OOM/stack-overrun during unrelated test target compilation.

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