MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / CollectEvents

Function CollectEvents

pkg/util/test/events.go:245–252  ·  view source on GitHub ↗

CollectEvents collects events published by f.

(f func())

Source from the content-addressed store, hash-verified

243
244// CollectEvents collects events published by f.
245func CollectEvents(f func()) []events.Event {
246 var evs []events.Event
247 defer SetDefaultEventsPubSub(&MockEventPubSub{
248 PublishFunc: func(evts ...events.Event) { evs = append(evs, evts...) },
249 })()
250 f()
251 return evs
252}
253
254// RedirectEvents redirects the published events to the
255// provided channel until the returned function is called.

Callers 1

TestCollectEventsFunction · 0.85

Calls 1

SetDefaultEventsPubSubFunction · 0.85

Tested by 1

TestCollectEventsFunction · 0.68