Ground item occurrences by canonical names
This commit is contained in:
@@ -25,16 +25,16 @@ func TestResolveUnboundRegistryHasExactEmptyProjection(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestResolveProjectsOrderedIDsAndNamesWithoutEvidence(t *testing.T) {
|
||||
func TestResolveProjectsOrderedNamesWithoutEvidence(t *testing.T) {
|
||||
registry := resolveRegistry(t, fixture())
|
||||
if !registry.Bound() || registry.Digest() == "" || registry.Count() != 2 {
|
||||
t.Fatalf("registry identity = bound %t digest %q count %d", registry.Bound(), registry.Digest(), registry.Count())
|
||||
}
|
||||
want := `{"items":[{"id":"` + identity.DeriveID("Silver Key") + `","name":"Silver Key"},{"id":"` + identity.DeriveID("Healer's Kit") + `","name":"Healer's Kit"}]}`
|
||||
want := `{"items":[{"name":"Silver Key"},{"name":"Healer's Kit"}]}`
|
||||
if got := string(registry.PromptInput().Content); got != want {
|
||||
t.Fatalf("prompt projection = %s, want %s", got, want)
|
||||
}
|
||||
for _, forbidden := range []string{"source_refs", "source_id", "session-alpha"} {
|
||||
for _, forbidden := range []string{"item:sha256:", "source_refs", "source_id", "session-alpha"} {
|
||||
if strings.Contains(string(registry.PromptInput().Content), forbidden) {
|
||||
t.Fatalf("projection leaked %q: %s", forbidden, registry.PromptInput().Content)
|
||||
}
|
||||
@@ -52,6 +52,9 @@ func TestRegistryAccessorsAndLookupsAreDefensive(t *testing.T) {
|
||||
if item, ok := registry.LookupID(identity.DeriveID("Healer's Kit")); !ok || item.Name != "Healer's Kit" {
|
||||
t.Fatalf("LookupID() = %#v, %t", item, ok)
|
||||
}
|
||||
if _, ok := registry.Lookup("Unknown Item"); ok {
|
||||
t.Fatal("Lookup() accepted an unknown item")
|
||||
}
|
||||
|
||||
items := registry.Items()
|
||||
items[0].Name = "changed"
|
||||
|
||||
Reference in New Issue
Block a user