1
0
Fork 0
mirror of https://github.com/eosswedenorg/thalos synced 2026-06-16 04:24:56 +02:00

api/client_test.go: add test for calling Subscribe with nil handler.

This commit is contained in:
Henrik Hautakoski 2024-02-04 14:30:59 +01:00
parent e7ad37c38a
commit bcd4a93c46

View file

@ -4,6 +4,7 @@ import (
"testing"
"github.com/eosswedenorg/thalos/api/message"
"github.com/stretchr/testify/assert"
)
type mockReader struct{}
@ -48,3 +49,13 @@ func TestClient_Subscribe(t *testing.T) {
})
}
}
func TestClient_SubscribeWithNilHandler(t *testing.T) {
client := NewClient(nil, nil)
client.OnAction = mockActionHandler
client.OnHeartbeat = mockHbHandler
err := client.Subscribe(TableDeltaChannel{Name: "name"}.Channel())
assert.Error(t, err)
}