Skip to content

Commit

Permalink
fix streams tests
Browse files Browse the repository at this point in the history
Signed-off-by: nyagamunene <[email protected]>
  • Loading branch information
nyagamunene committed Aug 1, 2024
1 parent c6cb35f commit 2f64454
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion bootstrap/events/producer/streams_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ func TestAdd(t *testing.T) {
saveErr error
err error
event map[string]interface{}
page mgsdk.ConnectionsPage
verifyErr errors.SDKError
}{
{
desc: "create config successfully",
Expand Down Expand Up @@ -208,7 +210,8 @@ func TestAdd(t *testing.T) {
authCall1 := auth.On("Authorize", context.Background(), mock.Anything).Return(tc.authResponse, tc.authorizeErr)
sdkCall := sdk.On("Thing", tc.config.ThingID, tc.token).Return(mgsdk.Thing{ID: tc.config.ThingID, Credentials: mgsdk.Credentials{Secret: tc.config.ThingKey}}, errors.NewSDKError(tc.thingErr))
repoCall := boot.On("ListExisting", context.Background(), domainID, mock.Anything).Return(tc.config.Channels, tc.listErr)
repoCall1 := boot.On("Save", context.Background(), mock.Anything, mock.Anything).Return(mock.Anything, tc.saveErr)
repoCall1 := sdk.On("VerifyConnections", mock.Anything, mock.Anything).Return(tc.page, tc.verifyErr)
repoCall2 := boot.On("Save", context.Background(), mock.Anything, mock.Anything).Return(mock.Anything, tc.saveErr)

_, err := svc.Add(context.Background(), tc.token, tc.config)
assert.True(t, errors.Contains(err, tc.err), fmt.Sprintf("%s: expected %s got %s\n", tc.desc, tc.err, err))
Expand All @@ -232,6 +235,7 @@ func TestAdd(t *testing.T) {
sdkCall.Unset()
repoCall.Unset()
repoCall1.Unset()
repoCall2.Unset()
}
}

Expand Down

0 comments on commit 2f64454

Please sign in to comment.