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

Function TestCollectEvents

pkg/util/test/events_test.go:76–93  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

74}
75
76func TestCollectEvents(t *testing.T) {
77 ctx := Context()
78 testEvent1 := events.New(ctx, "test-collect-events-1", "test-event-1",
79 events.WithIdentifiers(&ttnpb.ApplicationIdentifiers{ApplicationId: "test-app"}),
80 )
81 testEvent2 := events.New(ctx, "test-collect-events-2", "test-event-2",
82 events.WithIdentifiers(&ttnpb.GatewayIdentifiers{GatewayId: "test-gtw"}),
83 )
84 assertions.New(t).So(CollectEvents(func() {
85 events.Publish(testEvent1)
86 events.Publish(testEvent1)
87 events.Publish(testEvent2)
88 }), should.Resemble, []events.Event{
89 testEvent1,
90 testEvent1,
91 testEvent2,
92 })
93}
94
95func TestRedirectEvents(t *testing.T) {
96 ctx := Context()

Callers

nothing calls this directly

Calls 6

NewFunction · 0.92
WithIdentifiersFunction · 0.92
PublishFunction · 0.92
ContextFunction · 0.85
CollectEventsFunction · 0.85
NewMethod · 0.65

Tested by

no test coverage detected