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

Function TestParseGraphQLVarPaginationRoot

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

Source from the content-addressed store, hash-verified

4975}
4976
4977func TestParseGraphQLVarPaginationRoot(t *testing.T) {
4978 for _, q := range []string{
4979 "query test($a: int = 2){ q(func: uid(0x1), first: $a) { name }}",
4980 "query test($a: int = 2){ q(func: uid(0x1), offset: $a) { name }}",
4981 "query test($a: int = 2){ q(func: uid(0x1), orderdesc: name, first: $a) { name }}",
4982 "query test($a: int = 2){ q(func: uid(0x1), orderdesc: name, offset: $a) { name }}",
4983 "query test($a: int = 2){ q(func: eq(name, \"abc\"), orderdesc: name, first: $a) { name }}",
4984 "query test($a: int = 2){ q(func: eq(name, \"abc\"), orderdesc: name, offset: $a) { name }}",
4985 } {
4986 r := Request{
4987 Str: q,
4988 Variables: map[string]string{"$a": "3"},
4989 }
4990 gq, err := Parse(r)
4991 t.Log(q)
4992 t.Log(err)
4993 require.NoError(t, err)
4994 args := gq.Query[0].Args
4995 require.True(t, args["first"] == "3" || args["offset"] == "3")
4996 }
4997}
4998
4999func TestParseGraphQLVarPaginationChild(t *testing.T) {
5000 for _, q := range []string{

Callers

nothing calls this directly

Calls 2

LogMethod · 0.80
ParseFunction · 0.70

Tested by

no test coverage detected