FakeBus is an in-memory messaging.MessagingClient that delivers each published message synchronously to every registered subscriber whose subject filter matches, including NATS-style wildcard subjects (`*` matches exactly one token). Synchronous delivery keeps specs deterministic: the moment Publis
| 21 | // delivery semantics. It deliberately depends only on the standard library and |
| 22 | // the messaging package — no test framework — so it is importable anywhere. |
| 23 | type FakeBus struct { |
| 24 | mu sync.Mutex |
| 25 | subs []fakeBusSub |
| 26 | // publishCounts records how many messages were published per subject, so a |
| 27 | // spec can assert the echo-loop guard (an applied delta must not re-publish). |
| 28 | publishCounts map[string]int |
| 29 | |
| 30 | // reconnectCbs back the optional OnReconnect/TriggerReconnect pair, letting a |
| 31 | // spec exercise the component's reconnect re-hydrate path without a real |
| 32 | // NATS server. |
| 33 | reconnectCbs []func() |
| 34 | } |
| 35 | |
| 36 | type fakeBusSub struct { |
| 37 | subject string |
nothing calls this directly
no outgoing calls
no test coverage detected