Documentation
¶
Index ¶
- func EncodeMockGraphQLResponse(data any, err *graphql.Error) string
- func NewMockGraphQLAffectedRowsResponse(mutationName string, affectedRows int) string
- func NewMockGraphQLClient(responses []MockGraphQLResponse) *graphql.Client
- func NewMockGraphQLClientQueries(responses map[string]string) *graphql.Client
- func NewMockGraphQLClientSingle(data any, err *graphql.Error) *graphql.Client
- type MockDoType
- type MockGraphQLResponse
- type MockHTTPClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EncodeMockGraphQLResponse ¶
EncodeMockGraphQLResponse encodes data inputs to the graphql response payload
func NewMockGraphQLAffectedRowsResponse ¶
NewMockGraphQLAffectedRowsResponse returns json response of a mutation response with affectedRows
func NewMockGraphQLClient ¶
func NewMockGraphQLClient(responses []MockGraphQLResponse) *graphql.Client
NewMockGraphQLClient creates a mock graphql client of type HTTPClient where the mock Do() implementation returns the response and status code provided as params to the func.
func NewMockGraphQLClientQueries ¶
NewMockGraphQLClientSingle creates a mock graphql client with response map Find responses by query string without validating variables
func NewMockGraphQLClientSingle ¶
func NewMockGraphQLClientSingle(data any, err *graphql.Error) *graphql.Client
NewMockGraphQLClientSingle creates a mock graphql client with static response
Types ¶
type MockGraphQLResponse ¶
type MockGraphQLResponse struct { Request graphql.GraphQLRequestPayload Response any }
type MockHTTPClient ¶
type MockHTTPClient struct {
MockDo MockDoType
}
func NewMockHTTPClient ¶
func NewMockHTTPClient(jsonResp string, statusCode int) *MockHTTPClient
NewMockHTTPClient creates a mock client of type HTTPClient where the mock Do() implementation returns the reponse and status code provided as params to the function.