Minimize D&D NPC extraction contracts
This commit is contained in:
@@ -26,12 +26,12 @@ func TestNormalizeCanonicalizesFieldsAndRegistryIdentities(t *testing.T) {
|
||||
}
|
||||
resolution := " the target is hit "
|
||||
input := dnd.CombatTurnList{CombatTurns: []dnd.CombatTurn{{
|
||||
Actor: " storm ",
|
||||
Actor: " aria ",
|
||||
TurnKind: dnd.CombatTurnKindTurn,
|
||||
Actions: []dnd.CombatAction{{
|
||||
Category: dnd.CombatActionCategoryAttack,
|
||||
Declaration: " attacks\n with a sword ",
|
||||
Targets: []string{" minion ", "goblin", " unknown combatant "},
|
||||
Targets: []string{" goblin ", "goblin", " unknown combatant "},
|
||||
Resolution: &resolution,
|
||||
}},
|
||||
Summary: " Aria\n attacks ",
|
||||
@@ -77,10 +77,10 @@ func TestNormalizeResolvesOperationNPCOverrideWithoutSingletonMetadata(t *testin
|
||||
t.Fatalf("New() error = %v", err)
|
||||
}
|
||||
input := dnd.CombatTurnList{CombatTurns: []dnd.CombatTurn{{
|
||||
Actor: "Storm",
|
||||
Actor: "aria",
|
||||
TurnKind: dnd.CombatTurnKindTurn,
|
||||
Actions: []dnd.CombatAction{{Category: dnd.CombatActionCategoryAttack, Declaration: "attacks", Targets: []string{"Minion"}}},
|
||||
Summary: "Storm attacks",
|
||||
Actions: []dnd.CombatAction{{Category: dnd.CombatActionCategoryAttack, Declaration: "attacks", Targets: []string{"goblin"}}},
|
||||
Summary: "Aria attacks",
|
||||
SourceRefs: []source.SourceRef{{SourceID: doc.ID, StartUnitID: 10, EndUnitID: 10}},
|
||||
}}}
|
||||
result, err := normalizer.Normalize(context.Background(), contracts.TypedNormalizeRequest[dnd.CombatTurnList]{
|
||||
@@ -222,7 +222,7 @@ func TestNormalizerPreparationMetadataFingerprintsAndModuleContract(t *testing.T
|
||||
if metadata := unbound.ManifestMetadata(); metadata["npc_registry_digest"] != nil || metadata["npc_count"] != nil || metadata["normalization_policy"] != normalizationPolicy || metadata["identity_policy"] != identity.Policy {
|
||||
t.Fatalf("unbound metadata = %#v", metadata)
|
||||
}
|
||||
if got := unbound.CheckpointFingerprints(); len(got) != 2 || got[0].Name != "normalization_policy" || got[1].Name != "identity_policy" {
|
||||
if got := unbound.CheckpointFingerprints(); len(got) != 3 || got[0].Name != "normalization_policy" || got[1].Name != "identity_policy" || got[2].Name != "npc_registry" || got[2].Value == "" {
|
||||
t.Fatalf("unbound fingerprints = %#v", got)
|
||||
}
|
||||
|
||||
@@ -305,8 +305,8 @@ func testDocument() *source.SourceDocument {
|
||||
func npcReferences(t *testing.T) contracts.ReferenceSet {
|
||||
t.Helper()
|
||||
npcs := dnd.NPCList{NPCs: []dnd.NPC{
|
||||
{ID: identity.DeriveID("Aria"), Name: "Aria", Aliases: []string{"Storm"}, Description: "a fighter", Relationships: []dnd.NPCRelationship{{Target: "Goblin", Relationship: "fights"}}, SourceRefs: []source.SourceRef{{SourceID: "npc-run", StartUnitID: 1, EndUnitID: 1}}},
|
||||
{ID: identity.DeriveID("Goblin"), Name: "Goblin", Aliases: []string{"Minion"}, Description: "a goblin", Relationships: []dnd.NPCRelationship{{Target: "Aria", Relationship: "fights"}}, SourceRefs: []source.SourceRef{{SourceID: "npc-run", StartUnitID: 1, EndUnitID: 1}}},
|
||||
{ID: identity.DeriveID("Aria"), Name: "Aria", SourceRefs: []source.SourceRef{{SourceID: "npc-run", StartUnitID: 1, EndUnitID: 1}}},
|
||||
{ID: identity.DeriveID("Goblin"), Name: "Goblin", SourceRefs: []source.SourceRef{{SourceID: "npc-run", StartUnitID: 1, EndUnitID: 1}}},
|
||||
}}
|
||||
content, err := npccodec.New().Encode(npcs)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user