(t *testing.T)
| 13 | ) |
| 14 | |
| 15 | func TestExample(t *testing.T) { |
| 16 | s := pubsub.NewServer() |
| 17 | s.SetLogger(log.TestingLogger()) |
| 18 | |
| 19 | require.NoError(t, s.Start()) |
| 20 | |
| 21 | t.Cleanup(func() { |
| 22 | if err := s.Stop(); err != nil { |
| 23 | t.Error(err) |
| 24 | } |
| 25 | }) |
| 26 | |
| 27 | ctx := context.Background() |
| 28 | |
| 29 | subscription, err := s.Subscribe(ctx, "example-client", query.MustCompile("abci.account.name='John'")) |
| 30 | require.NoError(t, err) |
| 31 | |
| 32 | events := []abci.Event{ |
| 33 | { |
| 34 | Type: "abci.account", |
| 35 | Attributes: []abci.EventAttribute{{Key: "name", Value: "John"}}, |
| 36 | }, |
| 37 | } |
| 38 | err = s.PublishWithEvents(ctx, "Tombstone", events) |
| 39 | require.NoError(t, err) |
| 40 | |
| 41 | assertReceive(t, "Tombstone", subscription.Out()) |
| 42 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…