github.com/dgraph-io/dgraph@v1.2.8/graphql/e2e/normal/normal_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 normal 18 19 import ( 20 "testing" 21 22 "github.com/dgraph-io/dgraph/graphql/e2e/common" 23 ) 24 25 func TestRunAll_Normal(t *testing.T) { 26 t.Skip() 27 common.RunAll(t) 28 } 29 30 func TestSchema_Normal(t *testing.T) { 31 t.Skip() 32 expectedDgraphSchema := ` 33 { 34 "schema": [{ 35 "predicate": "Author.country", 36 "type": "uid" 37 }, { 38 "predicate": "Author.dob", 39 "type": "datetime", 40 "index": true, 41 "tokenizer": ["year"] 42 }, { 43 "predicate": "Author.name", 44 "type": "string", 45 "index": true, 46 "tokenizer": ["hash", "trigram"] 47 }, { 48 "predicate": "Author.posts", 49 "type": "uid", 50 "list": true 51 }, { 52 "predicate": "Author.reputation", 53 "type": "float", 54 "index": true, 55 "tokenizer": ["float"] 56 }, { 57 "predicate": "Category.name", 58 "type": "string" 59 }, { 60 "predicate": "Category.posts", 61 "type": "uid", 62 "list": true 63 }, { 64 "predicate": "Character.appearsIn", 65 "type": "string", 66 "index": true, 67 "tokenizer": ["hash"], 68 "list": true 69 }, { 70 "predicate": "Character.name", 71 "type": "string", 72 "index": true, 73 "tokenizer": ["exact"] 74 }, { 75 "predicate": "Country.name", 76 "type": "string", 77 "index": true, 78 "tokenizer": ["trigram", "hash"] 79 }, { 80 "predicate": "Country.states", 81 "type": "uid", 82 "list": true 83 }, { 84 "predicate": "Droid.primaryFunction", 85 "type": "string" 86 }, { 87 "predicate": "Employee.ename", 88 "type": "string" 89 }, { 90 "predicate": "Human.starships", 91 "type": "uid", 92 "list": true 93 }, { 94 "predicate": "Human.totalCredits", 95 "type": "float" 96 }, { 97 "predicate": "Post.author", 98 "type": "uid" 99 }, { 100 "predicate": "Post.category", 101 "type": "uid" 102 }, { 103 "predicate": "Post.isPublished", 104 "type": "bool", 105 "index": true, 106 "tokenizer": ["bool"] 107 }, { 108 "predicate": "Post.numLikes", 109 "type": "int", 110 "index": true, 111 "tokenizer": ["int"] 112 }, { 113 "predicate": "Post.postType", 114 "type": "string", 115 "index": true, 116 "tokenizer": ["hash", "trigram"] 117 }, { 118 "predicate": "Post.tags", 119 "type": "string", 120 "index": true, 121 "tokenizer": ["exact"], 122 "list": true 123 }, { 124 "predicate": "Post.text", 125 "type": "string", 126 "index": true, 127 "tokenizer": ["fulltext"] 128 }, { 129 "predicate": "Post.title", 130 "type": "string", 131 "index": true, 132 "tokenizer": ["term", "fulltext"] 133 }, { 134 "predicate": "Post.topic", 135 "type": "string", 136 "index": true, 137 "tokenizer": ["exact"] 138 }, { 139 "predicate": "dgraph.graphql.schema", 140 "type": "string" 141 }, { 142 "predicate": "Starship.length", 143 "type": "float" 144 }, { 145 "predicate": "Starship.name", 146 "type": "string", 147 "index": true, 148 "tokenizer": ["term"] 149 }, { 150 "predicate": "State.country", 151 "type": "uid" 152 }, { 153 "predicate": "State.name", 154 "type": "string" 155 }, { 156 "predicate": "State.xcode", 157 "type": "string", 158 "index": true, 159 "tokenizer": ["trigram", "hash"], 160 "upsert": true 161 }, { 162 "predicate": "dgraph.type", 163 "type": "string", 164 "index": true, 165 "tokenizer": ["exact"], 166 "list": true 167 }], 168 "types": [{ 169 "fields": [{ 170 "name": "Author.name" 171 }, { 172 "name": "Author.dob" 173 }, { 174 "name": "Author.reputation" 175 }, { 176 "name": "Author.country" 177 }, { 178 "name": "Author.posts" 179 }], 180 "name": "Author" 181 }, { 182 "fields": [{ 183 "name": "Category.name" 184 }, { 185 "name": "Category.posts" 186 }], 187 "name": "Category" 188 }, { 189 "fields": [{ 190 "name": "Character.name" 191 }, { 192 "name": "Character.appearsIn" 193 }], 194 "name": "Character" 195 }, { 196 "fields": [{ 197 "name": "Country.name" 198 }, { 199 "name": "Country.states" 200 }], 201 "name": "Country" 202 }, { 203 "fields": [{ 204 "name": "Character.name" 205 }, { 206 "name": "Character.appearsIn" 207 }, { 208 "name": "Droid.primaryFunction" 209 }], 210 "name": "Droid" 211 }, { 212 "fields": [{ 213 "name": "Employee.ename" 214 }], 215 "name": "Employee" 216 }, { 217 "fields": [{ 218 "name": "Employee.ename" 219 }, { 220 "name": "Character.name" 221 }, { 222 "name": "Character.appearsIn" 223 }, { 224 "name": "Human.starships" 225 }, { 226 "name": "Human.totalCredits" 227 }], 228 "name": "Human" 229 }, { 230 "fields": [{ 231 "name": "Post.title" 232 }, { 233 "name": "Post.text" 234 }, { 235 "name": "Post.tags" 236 }, { 237 "name": "Post.topic" 238 }, { 239 "name": "Post.numLikes" 240 }, { 241 "name": "Post.isPublished" 242 }, { 243 "name": "Post.postType" 244 }, { 245 "name": "Post.author" 246 }, { 247 "name": "Post.category" 248 }], 249 "name": "Post" 250 }, { 251 "fields": [{ 252 "name": "dgraph.graphql.schema" 253 }], 254 "name": "dgraph.graphql" 255 }, { 256 "fields": [{ 257 "name": "Starship.name" 258 }, { 259 "name": "Starship.length" 260 }], 261 "name": "Starship" 262 }, { 263 "fields": [{ 264 "name": "State.xcode" 265 }, { 266 "name": "State.name" 267 }, { 268 "name": "State.country" 269 }], 270 "name": "State" 271 }] 272 } 273 ` 274 275 t.Run("graphql schema", func(t *testing.T) { 276 common.SchemaTest(t, expectedDgraphSchema) 277 }) 278 } 279 280 // func TestMain(m *testing.M) { 281 // schemaFile := "schema.graphql" 282 // schema, err := ioutil.ReadFile(schemaFile) 283 // if err != nil { 284 // panic(err) 285 // } 286 287 // jsonFile := "test_data.json" 288 // data, err := ioutil.ReadFile(jsonFile) 289 // if err != nil { 290 // panic(errors.Wrapf(err, "Unable to read file %s.", jsonFile)) 291 // } 292 293 // common.BootstrapServer(schema, data) 294 295 // os.Exit(m.Run()) 296 // }