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

Function TestParseGraphQLVarPaginationChild

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

Source from the content-addressed store, hash-verified

4997}
4998
4999func TestParseGraphQLVarPaginationChild(t *testing.T) {
5000 for _, q := range []string{
5001 "query test($a: int = 2){ q(func: uid(0x1)) { friend(first: $a) }}",
5002 "query test($a: int = 2){ q(func: uid(0x1)) { friend(offset: $a) }}",
5003 "query test($a: int = 2){ q(func: uid(0x1), orderdesc: name) { friend(first: $a) }}",
5004 "query test($a: int = 2){ q(func: uid(0x1), orderdesc: name) { friend(offset: $a) }}",
5005 "query test($a: int = 2){ q(func: eq(name, \"abc\"), orderdesc: name) { friend(first: $a) }}",
5006 "query test($a: int = 2){ q(func: eq(name, \"abc\"), orderdesc: name) { friend(offset: $a) }}",
5007 } {
5008 r := Request{
5009 Str: q,
5010 Variables: map[string]string{"$a": "3"},
5011 }
5012 gq, err := Parse(r)
5013 t.Log(q)
5014 t.Log(err)
5015 require.NoError(t, err)
5016 args := gq.Query[0].Children[0].Args
5017 require.True(t, args["first"] == "3" || args["offset"] == "3")
5018 }
5019}
5020
5021func TestParseGraphQLVarPaginationRootMultiple(t *testing.T) {
5022 q := `query test($a: int, $b: int, $after: string){

Callers

nothing calls this directly

Calls 2

LogMethod · 0.80
ParseFunction · 0.70

Tested by

no test coverage detected