diff --git a/internal/test/helpers.go b/internal/test/helpers.go index 1e9b74e92..3aa0db197 100644 --- a/internal/test/helpers.go +++ b/internal/test/helpers.go @@ -9,11 +9,12 @@ import ( "net/http" "net/http/httptest" "os" - "reflect" "strings" "testing" + "time" "github.com/google/go-cmp/cmp" + "github.com/google/uuid" ) type API interface { @@ -144,3 +145,15 @@ func TestRoute(t *testing.T, api API, external bool, method, path, body string, return } } + +func IgnoreDates() cmp.Option { + return cmp.Comparer(func(a, b time.Time) bool { return true }) +} + +func IgnoreUuids() cmp.Option { + return cmp.Comparer(func(a, b uuid.UUID) bool { return true }) +} + +func Ignore(what string) cmp.Option { + return cmp.FilterPath(func(p cmp.Path) bool { return p.String() == what }, cmp.Ignore()) +}