package proposal_generation import ( "encoding/json" "testing" "gitea.maximumdirect.net/eric/audita/v3/internal/core/glossary" "gitea.maximumdirect.net/eric/audita/v3/internal/core/schema" ) func TestProposalContextPreservesDistinctEntries(t *testing.T) { entries := []glossary.Entry{ {Collection: "spells", ID: "shield", Name: "Shield", Category: "spell", Description: "A spell"}, {Collection: "items", ID: "shield", Name: "Shield", Category: "item", Description: "An item"}, } variables, err := BuildProposalVariables(&schema.Transcript{}, entries, 0, "") if err != nil { t.Fatal(err) } var decoded []glossary.Entry if err := json.Unmarshal([]byte(variables["GlossaryJSON"]), &decoded); err != nil { t.Fatal(err) } if len(decoded) != 2 || decoded[0].Category != "spell" || decoded[1].Category != "item" { t.Fatalf("prompt entries=%+v", decoded) } }