Skip to content

Commit

Permalink
add additional checks
Browse files Browse the repository at this point in the history
  • Loading branch information
kainpets committed Jul 5, 2024
1 parent 80ecf83 commit fa97a3d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/integration/access_codes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ func TestAccessCodes(t *testing.T) {
)
require.NoError(t, err)
require.NotNil(t, createdAccessCodes, "Created access codes should not be nil")
assert.Len(t, createdAccessCodes, 1)
assert.NotEmpty(t, createdAccessCodes, "Created access codes should not be empty")
assert.Equal(t, len(deviceIds), len(createdAccessCodes))

Expand Down
27 changes: 27 additions & 0 deletions test/integration/devices_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ func TestDevices(t *testing.T) {
require.NoError(t, err)
assert.Len(t, devices, 2)

// query device with id
devices, err = seam.Devices.List(
ctx,
&seamgo.DevicesListRequest{
Expand All @@ -76,6 +77,32 @@ func TestDevices(t *testing.T) {
require.NoError(t, err)
assert.Equal(t, device.DisplayName, deviceWithId.DisplayName)

// query device with name
device = getTestDevice(t, seam)
require.NotNil(t, device, "Test device should not be nil")

deviceByName, err := seam.Devices.Get(
ctx,
&seamgo.DevicesGetRequest{
Name: &device.DisplayName,
},
)
require.NoError(t, err)
assert.NotNil(t, deviceByName, "Device queried by name should not be nil")
assert.Equal(t, device.DisplayName, deviceByName.DisplayName)

deviceByNameAndId, err := seam.Devices.Get(
ctx,
&seamgo.DevicesGetRequest{
Name: &device.DisplayName,
DeviceId: &device.DeviceId,
},
)
require.NoError(t, err)
assert.NotNil(t, deviceByNameAndId, "Device queried by name and ID should not be nil")
assert.Equal(t, device.DisplayName, deviceByNameAndId.DisplayName)
assert.Equal(t, device.DeviceId, deviceByNameAndId.DeviceId)

locks, err := seam.Locks.List(
ctx,
nil,
Expand Down

0 comments on commit fa97a3d

Please sign in to comment.