Skip to content

broadcaster.ts: Write tests for message ordering guarantees #697

Description

@Kingsman-99

Description

src/broadcaster.ts delivers messages to subscribers, but there are no tests confirming that messages are delivered in the order they were broadcast. Out-of-order delivery can cause subtle bugs in state machines that depend on event sequencing.

Acceptance Criteria

  • Test: three messages broadcast in sequence arrive at the subscriber in the same order
  • Test: a subscriber added after some messages are broadcast does not receive missed messages
  • Test: removing a subscriber mid-sequence stops delivery for subsequent messages only
  • Unit tests pass

Context

  • Target file: src/broadcaster.ts
  • Tests should live in src/__tests__/broadcaster.test.ts

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions