package validate import ( "strings" "testing" "thehouseoficarus/internal/behavior" ) // Regression: a talk config with nodes but no "start" node is dead content at // runtime; validation must report it. func TestValidateTalkConfigRequiresStartNode(t *testing.T) { cfg := &behavior.TalkConfig{Nodes: map[string]behavior.TalkNode{ "greet": {Messages: []string{"hi"}}, }} issues := validateTalkConfig("test", cfg, nil, nil, nil, nil) found := false for _, iss := range issues { if strings.Contains(iss.Message, "start") { found = true } } if !found { t.Fatalf("missing start node not reported: %+v", issues) } clean := &behavior.TalkConfig{Nodes: map[string]behavior.TalkNode{"start": {}}} for _, iss := range validateTalkConfig("test", clean, nil, nil, nil, nil) { if strings.Contains(iss.Message, "start") { t.Fatalf("start node wrongly reported: %+v", iss) } } } // Regression: a gather drop with weight <= 0 can never be selected (the // weighted roll has zero total); it must be flagged. func TestValidateGatherWarnsOnWeightlessDrop(t *testing.T) { cfg := &behavior.GatherConfig{Drops: []behavior.DropEntry{{ItemID: "ore", Weight: 0}}} issues := validateGather("test", cfg, map[string]bool{"ore": true}, map[string]bool{}) found := false for _, iss := range issues { if strings.Contains(iss.Message, "weight") { found = true } } if !found { t.Fatalf("weightless drop not warned: %+v", issues) } }