Harden item occurrence grounding
This commit is contained in:
@@ -9,29 +9,6 @@ import (
|
||||
"gitea.maximumdirect.net/eric/notarius/internal/modules/dnd"
|
||||
)
|
||||
|
||||
func TestComparisonKeyNormalizesSupportedEquivalences(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
left string
|
||||
right string
|
||||
}{
|
||||
{name: "case", left: "Silver Key", right: "sILVER kEY"},
|
||||
{name: "compatibility", left: "Silver Key", right: "Silver Key"},
|
||||
{name: "whitespace", left: " Silver\u2003Key ", right: "Silver Key"},
|
||||
{name: "apostrophe", left: "Healer’s Kit", right: "healer's kit"},
|
||||
}
|
||||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
if ComparisonKey(test.left) != ComparisonKey(test.right) {
|
||||
t.Fatalf("ComparisonKey(%q) = %q, ComparisonKey(%q) = %q", test.left, ComparisonKey(test.left), test.right, ComparisonKey(test.right))
|
||||
}
|
||||
})
|
||||
}
|
||||
if ComparisonKey("Silver Key") == ComparisonKey("Gold Key") {
|
||||
t.Fatal("different item types received the same comparison key")
|
||||
}
|
||||
}
|
||||
|
||||
func TestDeriveIDUsesExactCompactIdentityBytes(t *testing.T) {
|
||||
const wantID = "item:sha256:2f211c60b9bdcf3a6dd64086cc4c05df5b3357ae02cb462f7ef8988d9bd2fa4f"
|
||||
const wantIdentity = `["dnd.item_registry.identity.v1","silver key"]`
|
||||
|
||||
Reference in New Issue
Block a user