Skip to content

Commit edf294c

Browse files
committed
Add test coverage in client_test.go
1 parent dcad36a commit edf294c

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

components/camera/client_test.go

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,24 @@ func TestClient(t *testing.T) {
490490
test.That(t, depthImg.Bounds().Dy(), test.ShouldEqual, 20)
491491
test.That(t, rimage.ImagesExactlyEqual(depthImg, expectedDepth), test.ShouldBeTrue)
492492
})
493+
494+
t.Run("invalid mime type", func(t *testing.T) {
495+
_, _, err := camClient.Images(ctx, []string{"this_is_an_invalid_source_name"}, nil)
496+
test.That(t, err, test.ShouldBeError)
497+
test.That(t, err.Error(), test.ShouldContainSubstring, "unknown source name: this_is_an_invalid_source_name")
498+
})
499+
500+
t.Run("mixture of valid and invalid source names", func(t *testing.T) {
501+
_, _, err := camClient.Images(ctx, []string{"color", "invalid_source"}, nil)
502+
test.That(t, err, test.ShouldBeError)
503+
test.That(t, err.Error(), test.ShouldContainSubstring, "unknown source name: invalid_source")
504+
})
505+
506+
t.Run("duplicate source names", func(t *testing.T) {
507+
_, _, err := camClient.Images(ctx, []string{"color", "color"}, nil)
508+
test.That(t, err, test.ShouldBeError)
509+
test.That(t, err.Error(), test.ShouldContainSubstring, "duplicate source name in filter: color")
510+
})
493511
})
494512
}
495513

@@ -984,7 +1002,7 @@ func TestMultiplexOverMultiHopRemoteConnection(t *testing.T) {
9841002
test.That(t, cameraClient.(rtppassthrough.Source).Unsubscribe(mainCtx, sub.ID), test.ShouldBeNil)
9851003
}
9861004

987-
//nolint
1005+
// nolint
9881006
// NOTE: These tests fail when this condition occurs:
9891007
//
9901008
// logger.go:130: 2024-06-17T16:56:14.097-0400 DEBUG TestGrandRemoteRebooting.remote-1.rdk:remote:/remote-2.webrtc rpc/wrtc_client_channel.go:299 no stream for id; discarding {"ch": 0, "id": 11}

0 commit comments

Comments
 (0)