package main import ( "strings" "testing" ) // hq issue 492: the first live review (research 046) sent a valid proposal back because the rules it was shown // named no link kind propose accepts beyond its words, and the record it was shown carried the record's state // `proposed` where a research effort's status belongs. // Every link kind propose accepts is named in the rules the judgement sees: one list, so the two cannot drift. func TestTheReviewIsShownEveryLinkKindProposeAccepts(t *testing.T) { q := ReviewQuestion(&Record{Kind: KindDecision, Number: 300, Title: "x", Status: StatusProposed}, nil) for _, kind := range LinkKinds { if !strings.Contains(q, "- `"+kind+"`: ") { t.Errorf("the review is not shown the link kind %s", kind) } } for _, kind := range LinkKinds { if strings.TrimSpace(LinkMeanings[kind]) == "" { t.Errorf("the link kind %s says nothing of what it means", kind) } } if len(LinkMeanings) != len(LinkKinds) { t.Errorf("%d meanings for %d link kinds", len(LinkMeanings), len(LinkKinds)) } } // A research effort's own status is shown apart from its state in the knowledge base. func TestTheReviewIsShownAResearchEffortsStatusApartFromItsState(t *testing.T) { w := imported(t, newMemStore()) r, err := w.k.ReserveNumber("author@g14", KindResearch, "a vendor-neutral inference layer") if err != nil { t.Fatal(err) } if _, err := w.k.Propose("author@g14", ProposeAsk{Kind: KindResearch, Number: r.Number, Title: "A vendor-neutral inference layer", Date: "2026-10-11", Deciders: []string{"jochen"}, Status: StatusActive, Sections: []Section{{Name: "00-overview.md", Text: "What an inference layer the mesh controls would be."}}, Links: []LinkAsk{{Kind: LinkTouches, To: "0290"}, {Kind: LinkTouches, To: "issue 365"}}}); err != nil { t.Fatal(err) } w.reviewAll(t) if len(w.judge.reviews) != 1 { t.Fatalf("%d reviews", len(w.judge.reviews)) } q := w.judge.reviews[0] record := q[strings.Index(q, "The record:"):] if !strings.Contains(record, "research status: active") || !strings.Contains(record, "state in the knowledge base: proposed") { t.Fatalf("the record as the review sees it:\n%.600s", record) } for _, never := range []string{"\nstatus: proposed", "\neffort: "} { if strings.Contains(record, never) { t.Errorf("the review is shown %q", strings.TrimSpace(never)) } } if !strings.Contains(q, "- `touches`: ") { t.Error("the review is not told what touches is") } }