Skip to content

Commit

Permalink
Ignore order when testing for nil values in test
Browse files Browse the repository at this point in the history
  • Loading branch information
aeneasr authored and fasmat committed Dec 10, 2021
1 parent 20bb080 commit d148b95
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions preload_associations_test.go
Expand Up @@ -158,8 +158,19 @@ func Test_New_Implementation_For_Nplus1_With_NullUUIDs_And_FK_ID(t *testing.T) {
// "created_at": "0001-01-01T00:00:00Z",
// "updated_at": "0001-01-01T00:00:00Z"
// },
a.NotNil(expected.Hops[0].Server, "%+v", expected.Hops[0])
a.Nil(expected.Hops[1].Server)
var foundValid, foundEmpty int
for _, hop := range expected.Hops {
if hop.ServerID.Valid {
foundValid++
a.NotNil(hop.Server, "%+v", hop)
} else {
foundEmpty++
a.Nil(hop.Server, "%+v", hop)
}
}

a.Equal(1, foundValid)
a.Equal(1, foundEmpty)
})
}

Expand Down

0 comments on commit d148b95

Please sign in to comment.