fix: replace ConsumeInbound with InboundChan select in client test

MessageBus does not expose a ConsumeInbound method. Use a select on
InboundChan() with context cancellation, matching the pattern used in
the bus package tests.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Amir Mamaghani 2026-03-20 13:21:33 +01:00
parent 7733c05095
commit 9be27c75a2

View file

@ -189,13 +189,14 @@ func TestClientChannel_ReceivesServerMessage(t *testing.T) {
// The echoed message.create is processed by handleServerMessage which
// calls HandleMessage → PublishInbound. Consume it from the bus.
msg, ok := mb.ConsumeInbound(ctx)
if !ok {
select {
case msg := <-mb.InboundChan():
if msg.Content != "ping" {
t.Fatalf("received = %q, want %q", msg.Content, "ping")
}
case <-ctx.Done():
t.Fatal("timed out waiting for echoed message")
}
if msg.Content != "ping" {
t.Fatalf("received = %q, want %q", msg.Content, "ping")
}
}
func TestClientChannel_StartTyping(t *testing.T) {