Skip to content

Commit

Permalink
Use imgbuf bytes directly for a robot client test rather than encode …
Browse files Browse the repository at this point in the history
…from img; Fix prev test bug
  • Loading branch information
hexbabe committed Nov 14, 2024
1 parent 9a9612f commit d31b434
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions robot/client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -332,9 +332,7 @@ func TestStatusClient(t *testing.T) {
test.That(t, png.Encode(&imgBuf, img), test.ShouldBeNil)

injectCamera.ImageFunc = func(ctx context.Context, mimeType string, extra map[string]interface{}) ([]byte, camera.ImageMetadata, error) {
resBytes, err := rimage.EncodeImage(ctx, img, mimeType)
test.That(t, err, test.ShouldBeNil)
return resBytes, camera.ImageMetadata{MimeType: mimeType}, nil
return imgBuf.Bytes(), camera.ImageMetadata{MimeType: rutils.MimeTypePNG}, nil
}

injectInputDev := &inject.InputController{}
Expand Down Expand Up @@ -510,7 +508,7 @@ func TestStatusClient(t *testing.T) {
test.That(t, err, test.ShouldNotBeNil)
test.That(t, err.Error(), test.ShouldContainSubstring, "not found")
test.That(t, imgBytes, test.ShouldBeNil)
test.That(t, metadata, test.ShouldEqual, camera.ImageMetadata{})
test.That(t, metadata, test.ShouldResemble, camera.ImageMetadata{})

gripper1, err := gripper.FromRobot(client, "gripper1")
test.That(t, err, test.ShouldBeNil)
Expand Down

0 comments on commit d31b434

Please sign in to comment.