Documentation
¶
Overview ¶
Package conformance is the executable contract of events.Broker.
The interface states the SIGNATURES; this package states the BEHAVIOUR — the same role github.com/tinywasm/router/conformance plays for router.Router. Two brokers can satisfy events.Broker and disagree on what matters (does a subscriber to topic A see an event published on topic B? does a second subscriber on the same topic see anything at all?). That has to become something that goes red, not folklore.
An implementation proves conformance from its own test package:
func TestMockConformance(t *testing.T) {
conformance.Run(t, conformance.Factory{New: func(t *testing.T) events.Broker { return &mock.Broker{} }})
}
Index ¶
Constants ¶
const ( TopicA = "conformance.a" TopicB = "conformance.b" )
TopicA and TopicB are the two topics the suite drives its cases with.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Factory ¶
Factory builds a fresh Broker for one case, so no case can be polluted by another's subscriptions.
type Fixture ¶
type Fixture struct{ Value string }
Fixture is the minimal model.Encodable payload the suite publishes, so a clause can assert the FIELDS survived delivery — not just that some Event arrived.
func (*Fixture) EncodeFields ¶
func (f *Fixture) EncodeFields(w model.FieldWriter)