Skip to content

Hook to check whole object in matcher recipe? #40

@james-w

Description

@james-w

How about a way to have a recipe with a check that is based on func(T) specta.MatchResult so that you can check multiple fields at the same time?

TODO.md mentions

// Multiple extractors at once
Fields[T any](extractors map[string]func(T) any) Matcher[T]

// Transform before matching
Transform[T, V any](name string, transform func(T) V, matcher Matcher[V]) Matcher[T]

// Predicate-based
Where[T any](description string, predicate func(T) bool) Matcher[T]

which seems to be along the same lines.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions