Finish the D&D module cleanup

This commit is contained in:
2026-07-25 13:30:23 +00:00
parent aeaaf44ae0
commit 29ee68824d
14 changed files with 76 additions and 366 deletions

View File

@@ -409,6 +409,28 @@ func TestAppendCombatTurnListsPreservesOrderPresenceAndOwnership(t *testing.T) {
}
}
func TestAppendListsPreserveNestedSourceReferencePresence(t *testing.T) {
spells, err := appendSpellLists([]dnd.SpellList{{SpellCasts: []dnd.SpellCast{{SourceRefs: []source.SourceRef{}}}}})
if err != nil || spells.SpellCasts[0].SourceRefs == nil {
t.Fatalf("appendSpellLists() = %#v, %v; want present-empty source refs", spells, err)
}
npcs, err := appendNPCLists([]dnd.NPCList{{NPCs: []dnd.NPC{{SourceRefs: []source.SourceRef{}}}}})
if err != nil || npcs.NPCs[0].SourceRefs == nil {
t.Fatalf("appendNPCLists() = %#v, %v; want present-empty source refs", npcs, err)
}
turns, err := appendCombatTurnLists([]dnd.CombatTurnList{{CombatTurns: []dnd.CombatTurn{{SourceRefs: []source.SourceRef{}}}}})
if err != nil || turns.CombatTurns[0].SourceRefs == nil {
t.Fatalf("appendCombatTurnLists() = %#v, %v; want present-empty source refs", turns, err)
}
interactions, err := appendNPCInteractionLists([]dnd.NPCInteractionList{{Interactions: []dnd.NPCInteraction{{SourceRefs: []source.SourceRef{}}}}})
if err != nil || interactions.Interactions[0].SourceRefs == nil {
t.Fatalf("appendNPCInteractionLists() = %#v, %v; want present-empty source refs", interactions, err)
}
}
func TestRegisterRejectsMissingDNDDependenciesBeforeMutation(t *testing.T) {
tests := []struct {
name string