Refactored Apply test
This commit is contained in:
@@ -230,3 +230,28 @@ func formatListDiff(listA, listB interface{}, extraA, extraB []interface{}) stri
|
||||
|
||||
return msg.String()
|
||||
}
|
||||
|
||||
// QueryElementsMatch asserts that two queries slices match
|
||||
func QueryElementsMatch(t TestingT, listA, listB interface{}, msgAndArgs ...interface{}) (ok bool) {
|
||||
t.Helper()
|
||||
|
||||
opt := cmp.FilterPath(func(p cmp.Path) bool {
|
||||
for _, ps := range p {
|
||||
switch ps := ps.(type) {
|
||||
case cmp.StructField:
|
||||
switch ps.Name() {
|
||||
case "ID",
|
||||
"UpdateCreateTimestamps",
|
||||
"AuthorID",
|
||||
"AuthorName",
|
||||
"AuthorEmail",
|
||||
"Packs",
|
||||
"Saved":
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}, cmp.Ignore())
|
||||
return ElementsMatchWithOptions(t, listA, listB, []cmp.Option{opt}, msgAndArgs)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user