Skip to content

Commit

Permalink
test: add test coverage for JSONDevices
Browse files Browse the repository at this point in the history
Signed-off-by: deadprogram <[email protected]>
  • Loading branch information
deadprogram committed Feb 25, 2017
1 parent 2bba294 commit c547630
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions robot_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,13 @@ func TestRobotToJSON(t *testing.T) {
gobottest.Assert(t, len(json.Devices), r.Devices().Len())
gobottest.Assert(t, len(json.Commands), len(r.Commands()))
}

func TestRobotDevicesToJSON(t *testing.T) {
r := newTestRobot("Robot99")
json := NewJSONRobot(r)
gobottest.Assert(t, len(json.Devices), r.Devices().Len())
gobottest.Assert(t, json.Devices[0].Name, "Device1")
gobottest.Assert(t, json.Devices[0].Driver, "*gobot.testDriver")
gobottest.Assert(t, json.Devices[0].Connection, "Connection1")
gobottest.Assert(t, len(json.Devices[0].Commands), 1)
}

0 comments on commit c547630

Please sign in to comment.