github.com/dgraph-io/dgraph@v1.2.8/graphql/e2e/directives/dgraph_directives_test.go (about) 1 /* 2 * Copyright 2019 Dgraph Labs, Inc. and Contributors 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package directives 18 19 import ( 20 "testing" 21 22 "github.com/dgraph-io/dgraph/graphql/e2e/common" 23 ) 24 25 func TestRunAll_WithDgraphDirectives(t *testing.T) { 26 t.Skip() 27 common.RunAll(t) 28 } 29 30 func TestSchema_WithDgraphDirectives(t *testing.T) { 31 t.Skip() 32 expectedDgraphSchema := ` 33 { 34 "schema": [ 35 { 36 "predicate": "Category.name", 37 "type": "string" 38 }, 39 { 40 "predicate": "Category.posts", 41 "type": "uid", 42 "list": true 43 }, 44 { 45 "predicate": "Country.name", 46 "type": "string", 47 "index": true, 48 "tokenizer": [ 49 "trigram", 50 "hash" 51 ] 52 }, 53 { 54 "predicate": "Human.starships", 55 "type": "uid", 56 "list": true 57 }, 58 { 59 "predicate": "dgraph.graphql.schema", 60 "type": "string" 61 }, 62 { 63 "predicate": "State.name", 64 "type": "string" 65 }, 66 { 67 "predicate": "State.xcode", 68 "type": "string", 69 "index": true, 70 "tokenizer": [ 71 "trigram", 72 "hash" 73 ], 74 "upsert": true 75 }, 76 { 77 "predicate": "appears_in", 78 "type": "string", 79 "index": true, 80 "tokenizer": [ 81 "hash" 82 ], 83 "list": true 84 }, 85 { 86 "predicate": "credits", 87 "type": "float" 88 }, 89 { 90 "predicate": "dgraph.author.country", 91 "type": "uid" 92 }, 93 { 94 "predicate": "dgraph.author.dob", 95 "type": "datetime", 96 "index": true, 97 "tokenizer": [ 98 "year" 99 ] 100 }, 101 { 102 "predicate": "dgraph.author.name", 103 "type": "string", 104 "index": true, 105 "tokenizer": [ 106 "hash", 107 "trigram" 108 ] 109 }, 110 { 111 "predicate": "dgraph.author.posts", 112 "type": "uid", 113 "list": true 114 }, 115 { 116 "predicate": "dgraph.author.reputation", 117 "type": "float", 118 "index": true, 119 "tokenizer": [ 120 "float" 121 ] 122 }, 123 { 124 "predicate": "dgraph.employee.en.ename", 125 "type": "string" 126 }, 127 { 128 "predicate": "dgraph.topic", 129 "type": "string", 130 "index": true, 131 "tokenizer": [ 132 "exact" 133 ] 134 }, 135 { 136 "predicate": "dgraph.type", 137 "type": "string", 138 "index": true, 139 "tokenizer": [ 140 "exact" 141 ], 142 "list": true 143 }, 144 { 145 "predicate": "hasStates", 146 "type": "uid", 147 "list": true 148 }, 149 { 150 "predicate": "inCountry", 151 "type": "uid" 152 }, 153 { 154 "predicate": "is_published", 155 "type": "bool", 156 "index": true, 157 "tokenizer": [ 158 "bool" 159 ] 160 }, 161 { 162 "predicate": "myPost.category", 163 "type": "uid" 164 }, 165 { 166 "predicate": "myPost.numLikes", 167 "type": "int", 168 "index": true, 169 "tokenizer": [ 170 "int" 171 ] 172 }, 173 { 174 "predicate": "myPost.postType", 175 "type": "string", 176 "index": true, 177 "tokenizer": [ 178 "hash", 179 "trigram" 180 ] 181 }, 182 { 183 "predicate": "myPost.tags", 184 "type": "string", 185 "index": true, 186 "tokenizer": [ 187 "exact" 188 ], 189 "list": true 190 }, 191 { 192 "predicate": "myPost.title", 193 "type": "string", 194 "index": true, 195 "tokenizer": [ 196 "term", 197 "fulltext" 198 ] 199 }, 200 { 201 "predicate": "performance.character.name", 202 "type": "string", 203 "index": true, 204 "tokenizer": [ 205 "exact" 206 ] 207 }, 208 { 209 "predicate": "post.author", 210 "type": "uid" 211 }, 212 { 213 "predicate": "roboDroid.primaryFunction", 214 "type": "string" 215 }, 216 { 217 "predicate": "star.ship.length", 218 "type": "float" 219 }, 220 { 221 "predicate": "star.ship.name", 222 "type": "string", 223 "index": true, 224 "tokenizer": [ 225 "term" 226 ] 227 }, 228 { 229 "predicate": "text", 230 "type": "string", 231 "index": true, 232 "tokenizer": [ 233 "fulltext" 234 ] 235 } 236 ], 237 "types": [ 238 { 239 "fields": [ 240 { 241 "name": "Category.name" 242 }, 243 { 244 "name": "Category.posts" 245 } 246 ], 247 "name": "Category" 248 }, 249 { 250 "fields": [ 251 { 252 "name": "Country.name" 253 }, 254 { 255 "name": "hasStates" 256 } 257 ], 258 "name": "Country" 259 }, 260 { 261 "fields": [ 262 { 263 "name": "dgraph.employee.en.ename" 264 }, 265 { 266 "name": "performance.character.name" 267 }, 268 { 269 "name": "appears_in" 270 }, 271 { 272 "name": "Human.starships" 273 }, 274 { 275 "name": "credits" 276 } 277 ], 278 "name": "Human" 279 }, 280 { 281 "fields": [ 282 { 283 "name": "dgraph.graphql.schema" 284 } 285 ], 286 "name": "dgraph.graphql" 287 }, 288 { 289 "fields": [ 290 { 291 "name": "State.xcode" 292 }, 293 { 294 "name": "State.name" 295 }, 296 { 297 "name": "inCountry" 298 } 299 ], 300 "name": "State" 301 }, 302 { 303 "fields": [ 304 { 305 "name": "dgraph.author.name" 306 }, 307 { 308 "name": "dgraph.author.dob" 309 }, 310 { 311 "name": "dgraph.author.reputation" 312 }, 313 { 314 "name": "dgraph.author.country" 315 }, 316 { 317 "name": "dgraph.author.posts" 318 } 319 ], 320 "name": "dgraph.author" 321 }, 322 { 323 "fields": [ 324 { 325 "name": "dgraph.employee.en.ename" 326 } 327 ], 328 "name": "dgraph.employee.en" 329 }, 330 { 331 "fields": [ 332 { 333 "name": "myPost.title" 334 }, 335 { 336 "name": "text" 337 }, 338 { 339 "name": "myPost.tags" 340 }, 341 { 342 "name": "dgraph.topic" 343 }, 344 { 345 "name": "myPost.numLikes" 346 }, 347 { 348 "name": "is_published" 349 }, 350 { 351 "name": "myPost.postType" 352 }, 353 { 354 "name": "post.author" 355 }, 356 { 357 "name": "myPost.category" 358 } 359 ], 360 "name": "myPost" 361 }, 362 { 363 "fields": [ 364 { 365 "name": "performance.character.name" 366 }, 367 { 368 "name": "appears_in" 369 } 370 ], 371 "name": "performance.character" 372 }, 373 { 374 "fields": [ 375 { 376 "name": "performance.character.name" 377 }, 378 { 379 "name": "appears_in" 380 }, 381 { 382 "name": "roboDroid.primaryFunction" 383 } 384 ], 385 "name": "roboDroid" 386 }, 387 { 388 "fields": [ 389 { 390 "name": "star.ship.name" 391 }, 392 { 393 "name": "star.ship.length" 394 } 395 ], 396 "name": "star.ship" 397 } 398 ] 399 } 400 ` 401 402 t.Run("graphql schema", func(t *testing.T) { 403 common.SchemaTest(t, expectedDgraphSchema) 404 }) 405 } 406 407 // func TestMain(m *testing.M) { 408 // schemaFile := "schema.graphql" 409 // schema, err := ioutil.ReadFile(schemaFile) 410 // if err != nil { 411 // panic(err) 412 // } 413 414 // jsonFile := "test_data.json" 415 // data, err := ioutil.ReadFile(jsonFile) 416 // if err != nil { 417 // panic(errors.Wrapf(err, "Unable to read file %s.", jsonFile)) 418 // } 419 420 // common.BootstrapServer(schema, data) 421 422 // os.Exit(m.Run()) 423 // }