Simplify D&D combat turn extraction contract
This commit is contained in:
@@ -186,12 +186,9 @@ func TestAppendNPCListsPreservesOrderAndArrayPresence(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAppendCombatTurnListsPreservesOrderPresenceAndOwnership(t *testing.T) {
|
||||
round := 1
|
||||
resolution := "hit"
|
||||
targets := []string{"Mira"}
|
||||
refs := []source.SourceRef{{SourceID: "session", StartUnitID: 1, EndUnitID: 1}}
|
||||
input := []dnd.CombatTurnList{
|
||||
{CombatTurns: []dnd.CombatTurn{{Actor: "first", Round: &round, Actions: []dnd.CombatAction{{Targets: targets, Resolution: &resolution}}, SourceRefs: refs}}},
|
||||
{CombatTurns: []dnd.CombatTurn{{Actor: "first", SourceRefs: refs}}},
|
||||
{CombatTurns: []dnd.CombatTurn{{Actor: "second"}}},
|
||||
}
|
||||
got, err := appendCombatTurnLists(input)
|
||||
@@ -201,7 +198,7 @@ func TestAppendCombatTurnListsPreservesOrderPresenceAndOwnership(t *testing.T) {
|
||||
if len(got.CombatTurns) != 2 || got.CombatTurns[0].Actor != "first" || got.CombatTurns[1].Actor != "second" {
|
||||
t.Fatalf("combat turns = %#v, want chunk order", got.CombatTurns)
|
||||
}
|
||||
if got.CombatTurns[0].Round == &round || &got.CombatTurns[0].Actions[0].Targets[0] == &targets[0] || got.CombatTurns[0].Actions[0].Resolution == &resolution || &got.CombatTurns[0].SourceRefs[0] == &refs[0] {
|
||||
if &got.CombatTurns[0].SourceRefs[0] == &refs[0] {
|
||||
t.Fatal("appendCombatTurnLists() retained nested input aliases")
|
||||
}
|
||||
tests := []struct {
|
||||
|
||||
Reference in New Issue
Block a user