Library to mock graphql requests.
m := mgql.New()
m.Query("GetAccount", func(ctx mgql.Context) {
ctx.Data(
mgql.Map{
"account": mgql.Map{
"id": ctx.Variables["id"],
},
},
)
})
testServer := httptest.NewServer(m.Handler())
ginkgo.BeforeEach(func() {
m.Reset()
})
It("creates service appointment when onboarding", func() {
// ...
m.Query("GetAccount", func(ctx mgql.Context) {
// ..
})
// ...
})
- func New() *MGQL
- func (m *MGQL) Handler() http.HandlerFunc
- func (m *MGQL) Mutation(operationName string, responseResolver ResponseResolver)
- func (m *MGQL) Query(operationName string, responseResolver ResponseResolver)
- func (m *MGQL) Reset()
- func (m *MGQL) SpyMutation(operationName string, responseResolver ResponseResolver)
- func (m *MGQL) SpyQuery(operationName string, responseResolver ResponseResolver)