Documentation
¶
Overview ¶
Package notifications supplies a recording custom-channel transport for tests. Bind it with notifications.Custom so tests exercise the production manager, storage and claim protocol; only the external send is replaced. Assertion failure text never includes rendered outputs or delivery IDs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertDelivered ¶
AssertDelivered requires at least one recorded output satisfying match (nil matches any).
func AssertDeliveredCount ¶
AssertDeliveredCount requires exactly want recorded outputs satisfying match.
Types ¶
type Delivery ¶
type Delivery[D any] struct { ID notifications.DeliveryID Data D }
Delivery is one recorded send.
type TestingT ¶
type TestingT interface {
// Helper marks the calling function as a test helper.
Helper()
// Errorf reports a formatted test failure.
Errorf(string, ...any)
}
TestingT is the test reporting contract used by notification assertions.
type Transport ¶
type Transport[D any] struct { // contains filtered or unexported fields }
Transport records delivered outputs in arrival order and answers with the configured outcome (Accepted by default). It is bounded by its capacity.
func (*Transport[D]) Deliver ¶
func (r *Transport[D]) Deliver(ctx context.Context, id notifications.DeliveryID, data D) (notifications.Outcome, error)
Deliver returns the configured outcome, recording accepted or unknown deliveries while capacity remains. Cancellation or full capacity requests retry.
func (*Transport[D]) Deliveries ¶
Deliveries returns a copy of the accepted (or unknown-outcome) sends.
func (*Transport[D]) Respond ¶
func (r *Transport[D]) Respond(outcome notifications.Outcome)
Respond selects the outcome for later deliveries, for example Retry to exercise a retry or Unknown to exercise an operator resolution.