Model heating mode when rooms have net heat loss in cold weather (<10°C). AC units with heat pump capability (canHeat) provide heating capacity, with the same 20% headroom threshold used for cooling. Adds cold risk detection, cold-weather actions, and full frontend support including heating mode timeline colors, room budget heating display, and i18n.
42 lines
978 B
Go
42 lines
978 B
Go
package action
|
|
|
|
import "testing"
|
|
|
|
func TestLoadDefaultActions(t *testing.T) {
|
|
actions, err := LoadDefaultActions()
|
|
if err != nil {
|
|
t.Fatalf("LoadDefaultActions: %v", err)
|
|
}
|
|
if len(actions) != 13 {
|
|
t.Errorf("len = %d, want 13", len(actions))
|
|
}
|
|
for _, a := range actions {
|
|
if a.ID == "" {
|
|
t.Error("action has empty ID")
|
|
}
|
|
if a.Name == "" {
|
|
t.Errorf("action %s has empty Name", a.ID)
|
|
}
|
|
if a.Category == "" {
|
|
t.Errorf("action %s has empty Category", a.ID)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestLoadDefaultActions_Categories(t *testing.T) {
|
|
actions, _ := LoadDefaultActions()
|
|
categories := make(map[Category]int)
|
|
for _, a := range actions {
|
|
categories[a.Category]++
|
|
}
|
|
if categories[Shading] != 2 {
|
|
t.Errorf("Shading actions = %d, want 2", categories[Shading])
|
|
}
|
|
if categories[Ventilation] != 4 {
|
|
t.Errorf("Ventilation actions = %d, want 4", categories[Ventilation])
|
|
}
|
|
if categories[Care] != 1 {
|
|
t.Errorf("Care actions = %d, want 1", categories[Care])
|
|
}
|
|
}
|