Finish the enemy engagement cleanup
This commit is contained in:
@@ -2,6 +2,7 @@ package engagements
|
||||
|
||||
import (
|
||||
"context"
|
||||
"reflect"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
@@ -35,11 +36,17 @@ func TestValidatorEnforcesOneEngagementPerSubject(t *testing.T) {
|
||||
}
|
||||
})
|
||||
}
|
||||
validator := New(Options{})
|
||||
for _, unitID := range []int{1, 2} {
|
||||
result, err := New(Options{}).Validate(context.Background(), contracts.TypedValidationRequest[dnd.EnemyEventList]{Value: events(event("Ashfang", dnd.EnemyEventKindEngaged, unitID))})
|
||||
value := events(event("Ashfang", dnd.EnemyEventKindEngaged, unitID))
|
||||
before := events(event("Ashfang", dnd.EnemyEventKindEngaged, unitID))
|
||||
result, err := validator.Validate(context.Background(), contracts.TypedValidationRequest[dnd.EnemyEventList]{Value: value})
|
||||
if err != nil || !result.Approved {
|
||||
t.Fatalf("separate scene validation = %#v, %v; want approved", result, err)
|
||||
}
|
||||
if !reflect.DeepEqual(value, before) {
|
||||
t.Fatalf("Validate() mutated separate scene value: got %#v, want %#v", value, before)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user