Documentation ¶
Index ¶
- Variables
- func FillDataToStore(s *store.Store, userName string, notes []model.NoteWithTodos)
- func GraphqlWithInput(v interface{}) map[string]interface{}
- func LoadTestUsers(s *store.Store)
- func NewDevUserNotesData(testApp *MockApp) []model.NoteWithTodos
- func NewTestUserNotesData(testApp *MockApp) []model.NoteWithTodos
- type MockApp
Constants ¶
This section is empty.
Variables ¶
var MutationAddNote = `` /* 135-byte string literal not displayed */
var MutationAddTodo = `
mutation ($input: AddTodoInput!){
addTodo(input: $input) {
id
name
done
noteId
}
}
`
var MutationDeleteNote = `mutation ($input: DeleteNoteInput!) {
deleteNote(input: $input) {
id
}
}`
var MutationDeleteTodo = `
mutation ($input: DeleteTodoInput!){
deleteTodo(input: $input) {
id
noteId
}
}
`
var MutationToggleTodo = `
mutation ($input: ToggleTodoInput!){
toggleTodo(input: $input) {
id
name
done
noteId
}
}
`
var MutationUpdateNote = `` /* 147-byte string literal not displayed */
var MutationUpdateTodo = `
mutation ($input: UpdateTodoInput!){
updateTodo(input: $input) {
id
name
done
noteId
}
}
`
var QueryNote = `
query($id: Int!){
note(id: $id) {
id
name
todos {
id
name
done
noteId
}
}
}
`
var QueryNotes = `
query {
notes {
id
name
todos {
id
name
done
noteId
}
}
}
`
GraphQL `note`
var QueryTodos = `
query ($noteId: Int!){
todos(noteId: $noteId) {
id
name
done
noteId
}
}
`
GraphQL `todo`
Functions ¶
func FillDataToStore ¶
func FillDataToStore(s *store.Store, userName string, notes []model.NoteWithTodos)
func GraphqlWithInput ¶
func GraphqlWithInput(v interface{}) map[string]interface{}
func LoadTestUsers ¶
func NewDevUserNotesData ¶
func NewDevUserNotesData(testApp *MockApp) []model.NoteWithTodos
func NewTestUserNotesData ¶
func NewTestUserNotesData(testApp *MockApp) []model.NoteWithTodos
Types ¶
type MockApp ¶
type MockApp struct { App *app.App RawAPI *httpexpect.Expect // Raw vanilla request with any header pre-injection API *httpexpect.Expect // With test user's auth header bearer token // contains filtered or unexported fields }
func NewMockApp ¶
func NewMockApp() MockApp
Each new test app will fork a new db session and will be cleanup after suite test.
func (*MockApp) GraphqlMustData ¶
sugar that expects the `data` only no error. It will return the `data` json object.
func (*MockApp) GraphqlMustError ¶
sugar to expects `errors` but `data` could exist with `null`. It will return the `errors` json array.
func (*MockApp) GraphqlPost ¶
graphql response always http succeed with json body as:
{ "data": { ... }, "errors": [ ... ] }
GraphqlPost is a bit raw graphql API that you need to extract the `data` and `errors` `opts` only supports two optional arguments, 1st argument is `variables` should be a `struct` with json tags or a `map[string]interface{}` that can be converted to a json. The 2nd argument must be a string for `operationName`. If no argument is provided then it will include no `variables` and `operationName`.