MCPcopy
hub / github.com/dgraph-io/dgraph / TestParseMissingGraphQLVar

Function TestParseMissingGraphQLVar

dql/parser_test.go:4957–4975  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

4955}
4956
4957func TestParseMissingGraphQLVar(t *testing.T) {
4958 for _, q := range []string{
4959 "{ q(func: eq(name, $a)) { name }}",
4960 "query { q(func: eq(name, $a)) { name }}",
4961 "query foo { q(func: eq(name, $a)) { name }}",
4962 "query foo () { q(func: eq(name, $a)) { name }}",
4963 "query foo ($b: string) { q(func: eq(name, $a)) { name }}",
4964 "query foo ($a: string) { q(func: eq(name, $b)) { name }}",
4965 } {
4966 r := Request{
4967 Str: q,
4968 Variables: map[string]string{"$a": "alice"},
4969 }
4970 _, err := Parse(r)
4971 t.Log(q)
4972 t.Log(err)
4973 require.Error(t, err)
4974 }
4975}
4976
4977func TestParseGraphQLVarPaginationRoot(t *testing.T) {
4978 for _, q := range []string{

Callers

nothing calls this directly

Calls 3

LogMethod · 0.80
ParseFunction · 0.70
ErrorMethod · 0.45

Tested by

no test coverage detected