added group decode tests

This commit is contained in:
Wlad Meixner 2019-02-15 13:46:33 +01:00
parent 9822b0e072
commit 2f0a138ccb

64
groups_test.go Normal file
View File

@ -0,0 +1,64 @@
package hue
import (
"testing"
"github.com/gosticks/go-hue-interface/utils"
)
func TestParseGroups(t *testing.T) {
v := make(map[string]*Group)
err := utils.CompareJSONDecode(groupsTestData, &v)
if err != nil {
t.Fail()
}
}
const groupsTestData = `
{
"1": {
"name": "Group 1",
"lights": [
"1",
"2"
],
"type": "LightGroup",
"action": {
"on": true,
"bri": 254,
"hue": 10000,
"sat": 254,
"effect": "none",
"xy": [
0.5,
0.5
],
"ct": 250,
"alert": "select",
"colormode": "ct"
}
},
"2": {
"name": "Group 2",
"lights": [
"3",
"4",
"5"
],
"type": "LightGroup",
"action": {
"on": true,
"bri": 153,
"hue": 4345,
"sat": 254,
"effect": "none",
"xy": [
0.5,
0.5
],
"ct": 250,
"alert": "select",
"colormode": "ct"
}
}
}`