Skip to content
Playground(another site)

bynk.test.event_publisher_ambiguous

Error A test body's svc.event(e) omits the envelope, but the event's publisher, which the default envelope names, is not one context the target declares or consumes.

svc.event(e) delivers an event in a default envelope, whose publisherId is the context that publishes the event to the target: its own, or the one context it consumes that declares it. When two consumed contexts both declare the event there is no single publisher to name, so the case must build the envelope itself. Pass svc.event(e, env), with an EventEnvelope whose publisherId names the one you mean; the target must consume EventEnvelope from bynk.

Example

shop/ledger.bynk
consumes shop.order
consumes shop.archive
consumes bynk { EventEnvelope }
// tests/ledger.test.bynk
let _ <- OnPlaced.event(Placed { id: "o1" }) // ✗ `shop.order` or `shop.archive`?
let env = EventEnvelope { eventId: "e1", publisherId: "shop.order", …
let _ <- OnPlaced.event(Placed { id: "o1" }, env) // ✓ the envelope names it

In the Book

See also

  • The grammar rule it governs: case.
  • Every code in its category, Tests, on the diagnostic index.
  • bynk explain bynk.test.event_publisher_ambiguous shows the same from the installed toolchain, without a network.