Compose D&D location tracking modules

This commit is contained in:
2026-08-04 00:39:00 +00:00
parent a168c13b85
commit 811d5b8bd9
8 changed files with 282 additions and 9 deletions

View File

@@ -27,7 +27,7 @@ func TestValidatorDistinguishesSameNameLocationsByID(t *testing.T) {
if err != nil || !result.Approved || !reflect.DeepEqual(value, before) {
t.Fatalf("matching IDs = %#v, %v", result, err)
}
value.Occurrences[0].Name = "Other Gate"
value.Occurrences[0].Name = "Sun Gate"
result, err = validator.Validate(context.Background(), request(references, value))
if err != nil || result.Approved || result.ReasonCode != ReasonCode || !strings.Contains(result.Message, "does not match registry location") {
t.Fatalf("mismatched name = %#v, %v", result, err)
@@ -101,7 +101,9 @@ func registryReferences(t *testing.T) (contracts.ReferenceSet, dnd.Location, dnd
secondRefs := []source.SourceRef{{SourceID: "source", StartUnitID: 2, EndUnitID: 2}}
first := dnd.Location{ID: identity.DeriveID("Moon Gate", firstRefs), Name: "Moon Gate", SourceRefs: firstRefs}
second := dnd.Location{ID: identity.DeriveID("Moon Gate", secondRefs), Name: "Moon Gate", SourceRefs: secondRefs}
content, err := locationcodec.New().Encode(dnd.LocationList{Locations: []dnd.Location{first, second}})
thirdRefs := []source.SourceRef{{SourceID: "source", StartUnitID: 3, EndUnitID: 3}}
third := dnd.Location{ID: identity.DeriveID("Sun Gate", thirdRefs), Name: "Sun Gate", SourceRefs: thirdRefs}
content, err := locationcodec.New().Encode(dnd.LocationList{Locations: []dnd.Location{first, second, third}})
if err != nil {
t.Fatal(err)
}