Skip to content

Commit 2a7f246

Browse files
heiytorotavio
authored andcommitted
fix(api): correct typo in 'OfflineDevice'
The service's `OfflineDevice` method was previously misspelled as `OffineDevice`. This has been corrected.
1 parent 6947e31 commit 2a7f246

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

api/routes/device.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ func (h *Handler) OfflineDevice(c gateway.Context) error {
175175
return err
176176
}
177177

178-
if err := h.service.OffineDevice(c.Ctx(), models.UID(req.UID), false); err != nil {
178+
if err := h.service.OfflineDevice(c.Ctx(), models.UID(req.UID), false); err != nil {
179179
return err
180180
}
181181

api/routes/device_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -429,15 +429,15 @@ func TestOfflineDevice(t *testing.T) {
429429
title: "fails when try to setting a non-existing device as offline",
430430
uid: "1234",
431431
requiredMocks: func() {
432-
mock.On("OffineDevice", gomock.Anything, models.UID("1234"), false).Return(svc.ErrNotFound)
432+
mock.On("OfflineDevice", gomock.Anything, models.UID("1234"), false).Return(svc.ErrNotFound)
433433
},
434434
expectedStatus: http.StatusNotFound,
435435
},
436436
{
437437
title: "success when try to setting an existing device as offline",
438438
uid: "123",
439439
requiredMocks: func() {
440-
mock.On("OffineDevice", gomock.Anything, models.UID("123"), false).Return(nil)
440+
mock.On("OfflineDevice", gomock.Anything, models.UID("123"), false).Return(nil)
441441
},
442442
expectedStatus: http.StatusOK,
443443
},

api/services/device.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ type DeviceService interface {
2424
DeleteDevice(ctx context.Context, uid models.UID, tenant string) error
2525
RenameDevice(ctx context.Context, uid models.UID, name, tenant string) error
2626
LookupDevice(ctx context.Context, namespace, name string) (*models.Device, error)
27-
OffineDevice(ctx context.Context, uid models.UID, online bool) error
27+
OfflineDevice(ctx context.Context, uid models.UID, online bool) error
2828
UpdateDeviceStatus(ctx context.Context, tenant string, uid models.UID, status models.DeviceStatus) error
2929
UpdateDevice(ctx context.Context, tenant string, uid models.UID, name *string, publicURL *bool) error
3030
}
@@ -176,7 +176,7 @@ func (s *service) LookupDevice(ctx context.Context, namespace, name string) (*mo
176176
return device, nil
177177
}
178178

179-
func (s *service) OffineDevice(ctx context.Context, uid models.UID, online bool) error {
179+
func (s *service) OfflineDevice(ctx context.Context, uid models.UID, online bool) error {
180180
err := s.store.DeviceSetOnline(ctx, uid, clock.Now(), online)
181181
if err == store.ErrNoDocuments {
182182
return NewErrDeviceNotFound(uid, err)

api/services/device_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1612,7 +1612,7 @@ func TestLookupDevice(t *testing.T) {
16121612
mock.AssertExpectations(t)
16131613
}
16141614

1615-
func TestOffineDevice(t *testing.T) {
1615+
func TestOfflineDevice(t *testing.T) {
16161616
mock := new(mocks.Store)
16171617

16181618
ctx := context.TODO()
@@ -1653,7 +1653,7 @@ func TestOffineDevice(t *testing.T) {
16531653
tc.requiredMocks()
16541654

16551655
service := NewService(store.Store(mock), privateKey, publicKey, storecache.NewNullCache(), clientMock, nil)
1656-
err := service.OffineDevice(ctx, tc.uid, tc.online)
1656+
err := service.OfflineDevice(ctx, tc.uid, tc.online)
16571657
assert.Equal(t, tc.expected, err)
16581658
})
16591659
}

api/services/mocks/services.go

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)