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

Function TestUidInWithParseErrors

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

Source from the content-addressed store, hash-verified

5126}
5127
5128func TestUidInWithParseErrors(t *testing.T) {
5129 tcases := []struct {
5130 description string
5131 query string
5132 expectedErr error
5133 }{
5134 {
5135 description: "uid_in query with without argument",
5136 query: `{
5137 me(func: uid(1, 23, 24 )) {
5138 friend @filter(uid_in(school, )) {
5139 name
5140 }
5141 }
5142 }`,
5143 expectedErr: errors.New("Empty Argument"),
5144 },
5145 {
5146 description: "uid_in query with without argument (2)",
5147 query: `{
5148 me(func: uid(1, 23, 24 )) {
5149 friend @filter(uid_in(school )) {
5150 name
5151 }
5152 }
5153 }`,
5154 expectedErr: errors.New("uid_in function expects an argument, got none"),
5155 },
5156 {
5157 description: "query with nested uid without variable",
5158 query: `{
5159 me(func: uid(1, 23, 24 )) {
5160 friend @filter(uid_in(school, uid(5000))) {
5161 name
5162 }
5163 }
5164 }`,
5165 expectedErr: errors.New("Nested uid fn expects 1 uid variable, got 0"),
5166 },
5167 {
5168 description: "query with nested uid with variable and constant",
5169 query: `{
5170 uidVar as q(func: uid( 5000))
5171 me(func: uid(1, 23, 24 )) {
5172 friend @filter(uid_in(school, uid(uidVar, 5001))) {
5173 name
5174 }
5175 }
5176 }`,
5177 expectedErr: errors.New("Nested uid fn expects only uid variable, got UID"),
5178 },
5179 {
5180 description: "query with nested uid with two variables",
5181 query: `{
5182 uidVar1 as q(func: uid( 5000))
5183 uidVar2 as q(func: uid( 5000))
5184 me(func: uid(1, 23, 24 )) {
5185 friend @filter(uid_in(school, uid(uidVar1, uidVar2))) {

Callers

nothing calls this directly

Calls 3

ParseFunction · 0.70
RunMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected