mirror of
https://github.com/eosswedenorg/thalos
synced 2026-08-23 19:48:12 +02:00
api/client_test.go: add test for calling Subscribe with nil handler.
This commit is contained in:
parent
e7ad37c38a
commit
bcd4a93c46
1 changed files with 11 additions and 0 deletions
|
|
@ -4,6 +4,7 @@ import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/eosswedenorg/thalos/api/message"
|
"github.com/eosswedenorg/thalos/api/message"
|
||||||
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
type mockReader struct{}
|
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)
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue