1
0
mirror of https://github.com/hybridgroup/gobot.git synced 2025-04-24 13:48:49 +08:00

test: add test coverage for JSONDevices

Signed-off-by: deadprogram <ron@hybridgroup.com>
This commit is contained in:
deadprogram 2017-02-25 12:31:41 +01:00
parent 2bba294b2f
commit c54763046b

View File

@ -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)
}