Skip to content

Commit

Permalink
refactor: Update ConnectThing and DisconnectThing
Browse files Browse the repository at this point in the history
Signed-off-by: JeffMboya <jangina.mboya@gmail.com>
  • Loading branch information
JeffMboya committed Jun 12, 2024
1 parent 66fbf81 commit 0473f46
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions bootstrap/events/producer/streams_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1098,7 +1098,7 @@ func TestConnectThingHandler(t *testing.T) {

lastID := "0"
for _, tc := range cases {
svcCall := boot.On("ConnectThing", context.Background(), tc.channelID, tc.thingID).Return(tc.err)
repoCall := boot.On("ConnectThing", context.Background(), tc.channelID, tc.thingID).Return(tc.err)
err := svc.ConnectThingHandler(context.Background(), tc.channelID, tc.thingID)
assert.Equal(t, tc.err, err, fmt.Sprintf("%s: expected %s got %s\n", tc.desc, tc.err, err))

Expand All @@ -1117,7 +1117,7 @@ func TestConnectThingHandler(t *testing.T) {
}

test(t, tc.event, event, tc.desc)
svcCall.Unset()
repoCall.Unset()
}
}

Expand Down Expand Up @@ -1179,7 +1179,7 @@ func TestDisconnectThingHandler(t *testing.T) {

lastID := "0"
for _, tc := range cases {
svcCall := boot.On("DisconnectThing", context.Background(), tc.channelID, tc.thingID).Return(tc.err)
repoCall := boot.On("DisconnectThing", context.Background(), tc.channelID, tc.thingID).Return(tc.err)
err := svc.DisconnectThingHandler(context.Background(), tc.channelID, tc.thingID)
assert.Equal(t, tc.err, err, fmt.Sprintf("%s: expected %s got %s\n", tc.desc, tc.err, err))

Expand All @@ -1198,7 +1198,7 @@ func TestDisconnectThingHandler(t *testing.T) {
}

test(t, tc.event, event, tc.desc)
svcCall.Unset()
repoCall.Unset()
}
}

Expand Down
4 changes: 2 additions & 2 deletions bootstrap/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ type Service interface {
// RemoveChannelHandler removes Channel with id received from an event.
RemoveChannelHandler(ctx context.Context, id string) error

// ConnectHandler changes state of the Config to active when connect event occurs.
// ConnectThingHandler changes state of the Config to active when connect event occurs.
ConnectThingHandler(ctx context.Context, channelID, ThingID string) error

// DisconnectHandler changes state of the Config to inactive when disconnect event occurs.
// DisconnectThingHandler changes state of the Config to inactive when disconnect event occurs.
DisconnectThingHandler(ctx context.Context, channelID, ThingID string) error
}

Expand Down

0 comments on commit 0473f46

Please sign in to comment.