MCPcopy Index your code
hub / github.com/dgraph-io/dgraph / TestJSONQueryVariables

Function TestJSONQueryVariables

query/query1_test.go:320–334  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

318}
319
320func TestJSONQueryVariables(t *testing.T) {
321
322 q := `query test ($a: int = 1) {
323 me(func: uid(0x01)) {
324 name
325 gender
326 friend(first: $a) {
327 name
328 }
329 }
330 }`
331 js, err := processQueryWithVars(t, q, map[string]string{"$a": "2"})
332 require.NoError(t, err)
333 require.JSONEq(t, `{"data": {"me":[{"friend":[{"name":"Rick Grimes"},{"name":"Glenn Rhee"}],"gender":"female","name":"Michonne"}]}}`, js)
334}
335
336func TestGraphQLVarsInUpsert(t *testing.T) {
337 req := &api.Request{

Callers

nothing calls this directly

Calls 1

processQueryWithVarsFunction · 0.70

Tested by

no test coverage detected