package action import "testing" func TestLoadDefaultActions(t *testing.T) { actions, err := LoadDefaultActions() if err != nil { t.Fatalf("LoadDefaultActions: %v", err) } if len(actions) != 10 { t.Errorf("len = %d, want 10", 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] != 2 { t.Errorf("Ventilation actions = %d, want 2", categories[Ventilation]) } if categories[Care] != 1 { t.Errorf("Care actions = %d, want 1", categories[Care]) } }