Documentation ¶
Index ¶
- func ConsistOfGraphQLErrors(matchers ...interface{}) types.GomegaMatcher
- func MatchGraphQLError(matchers ...ErrorFieldsMatcher) types.GomegaMatcher
- func SerializeToJSONAs(expected interface{}) types.GomegaMatcher
- type ErrorFieldsMatcher
- func KindIs(errKind graphql.ErrKind) ErrorFieldsMatcher
- func LocationEqual(location graphql.ErrorLocation) ErrorFieldsMatcher
- func LocationsConsistOf(locations []graphql.ErrorLocation) ErrorFieldsMatcher
- func MessageContainSubstring(s string) ErrorFieldsMatcher
- func MessageEqual(s string) ErrorFieldsMatcher
- func OriginalErrorMatch(err interface{}) ErrorFieldsMatcher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConsistOfGraphQLErrors ¶
func ConsistOfGraphQLErrors(matchers ...interface{}) types.GomegaMatcher
ConsistOfGraphQLErrors is used to match a graphql.Errors like an array of graphql.Error's with Gomega's ConsistOf.
Expect(errs).Should(ConsistOfGraphQLErrors( MatchGraphQLError( MessageContainSubstring("First error"), KindIs(graphql.ErrKindSyntax), ), MatchGraphQLError( MessageContainSubstring("Second error"), ), ))
func MatchGraphQLError ¶
func MatchGraphQLError(matchers ...ErrorFieldsMatcher) types.GomegaMatcher
MatchGraphQLError matches a graphql.Error with given fields.
The following example matches a graphql.Error including "Unterminated string" in the message and the error kind should match graphql.ErrKindSyntax.
Expect(err).Should(MatchGraphQLError( MessageContainSubstring("Unterminated string"), KindIs(graphql.ErrKindSyntax), ))
func SerializeToJSONAs ¶
func SerializeToJSONAs(expected interface{}) types.GomegaMatcher
SerializeToJSONAs returns a Gomega matcher that first serializes actual value into JSON data format and then decodes the data into a variable that has the same type as the expected value and compare the decoded result against the expected value.
Types ¶
type ErrorFieldsMatcher ¶
ErrorFieldsMatcher sets up fields to match.
func KindIs ¶
func KindIs(errKind graphql.ErrKind) ErrorFieldsMatcher
KindIs matches the kind in the error to be the same as the given one.
func LocationEqual ¶
func LocationEqual(location graphql.ErrorLocation) ErrorFieldsMatcher
LocationEqual matches the locations in the error to contain the only specified location.
func LocationsConsistOf ¶
func LocationsConsistOf(locations []graphql.ErrorLocation) ErrorFieldsMatcher
LocationsConsistOf matches locations in the error to include all given locations.
func MessageContainSubstring ¶
func MessageContainSubstring(s string) ErrorFieldsMatcher
MessageContainSubstring matches message in a graphql.Error to contain the specified string.
func MessageEqual ¶
func MessageEqual(s string) ErrorFieldsMatcher
MessageEqual matches message in a graphql.Error to be the same as the specified string.
func OriginalErrorMatch ¶
func OriginalErrorMatch(err interface{}) ErrorFieldsMatcher
OriginalErrorMatch matches original error with the given one using gomega.MatchError.