7 "github.com/stretchr/testify/require"
10 func TestReportedControlPreservesReadbackAndLocalHeatingMeaning(t *testing.T) {
11 testCases := []struct {
19 name: "powered off has no heating action",
24 name: "powered thermostat can be idle",
30 name: "active thermostat reports local heating",
38 for _, tc := range testCases {
39 t.Run(tc.name, func(t *testing.T) {
41 state.Power = tc.power
42 state.Active = tc.active
44 reported := newReportedControl(state)
45 require.Equal(t, tc.mode, reported.Settings.Mode)
46 require.Equal(t, tc.action, reported.Action)
48 data, err := json.Marshal(reported)
49 require.NoError(t, err)
50 require.Contains(t, string(data), `"current_temperature":19.5`)
51 require.Contains(t, string(data), `"floor_temperature":23`)
52 require.Contains(t, string(data), `"target_temperature":20`)
53 require.Contains(t, string(data), `"locked":true`)