From bcd4a93c46497e701fdbe1d989200c38a79e2dbc Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Sun, 4 Feb 2024 14:30:59 +0100 Subject: [PATCH] api/client_test.go: add test for calling Subscribe with nil handler. --- api/client_test.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/api/client_test.go b/api/client_test.go index 8fae00e..2b28b11 100644 --- a/api/client_test.go +++ b/api/client_test.go @@ -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) +}