Documentation ¶
Index ¶
- Variables
- func Assert(tb testing.TB, condition bool, msg string, v ...interface{})
- func Equals(tb testing.TB, exp, act interface{})
- func Fixture(path string) string
- func NewHttpClient(fn RoundTripFunc) *http.Client
- func Ok(tb testing.TB, err error)
- func RegisterEndpoint(endpoint string, responseWriter ResponseWriter, ...) string
- func Setup() func()
- func TemplatedFixture(fixture string) string
- func ToJson(query GraphqlQuery) string
- type FixtureTemplater
- type GraphqlQuery
- type RequestValidation
- type ResponseWriter
- type RoundTripFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Mux *http.ServeMux Server *httptest.Server Templater *FixtureTemplater )
Functions ¶
func RegisterEndpoint ¶
func RegisterEndpoint(endpoint string, responseWriter ResponseWriter, requestValidation RequestValidation) string
func Setup ¶
func Setup() func()
Setup an HttpTestServer and ServerMux (for path routing) and return the teardown function
func TemplatedFixture ¶
func ToJson ¶ added in v2022.11.9
func ToJson(query GraphqlQuery) string
Types ¶
type FixtureTemplater ¶
type FixtureTemplater struct {
// contains filtered or unexported fields
}
func NewFixtureTemplater ¶
func NewFixtureTemplater(templateDirs ...string) *FixtureTemplater
NewFixtureTemplater creates a FixtureTemplater using the templates load from the passed in templateDir
If no templateDir is passed in then ./testdata/templates is used
type GraphqlQuery ¶
func GraphQLQueryFixture ¶
func GraphQLQueryFixture(fixture string) GraphqlQuery
func Parse ¶
func Parse(r *http.Request) GraphqlQuery
type RequestValidation ¶
func GraphQLQueryFixtureValidation ¶
func GraphQLQueryFixtureValidation(t *testing.T, fixture string) RequestValidation
func GraphQLQueryValidation ¶
func GraphQLQueryValidation(t *testing.T, exp string) RequestValidation
func SkipRequestValidation ¶
func SkipRequestValidation() RequestValidation
type ResponseWriter ¶
type ResponseWriter func(http.ResponseWriter)
func EmptyResponse ¶
func EmptyResponse() ResponseWriter
func FixtureResponse ¶
func FixtureResponse(fixture string) ResponseWriter
Click to show internal directories.
Click to hide internal directories.