Skip to content

Commit 6c381c9

Browse files
authored
Simplify type system test cases (#101)
Ref: hypermodeinc/dgraph#4017
1 parent c46c9ca commit 6c381c9

File tree

1 file changed

+57
-40
lines changed

1 file changed

+57
-40
lines changed

examples_test.go

+57-40
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ func ExampleTxn_Query_variables() {
8787
name: string @index(exact) .
8888
8989
type Person {
90-
name: string
90+
name
9191
}
9292
`
9393

@@ -206,24 +206,24 @@ func ExampleTxn_Mutate() {
206206

207207
op := &api.Operation{}
208208
op.Schema = `
209+
name: string @index(exact) .
209210
age: int .
210211
married: bool .
212+
Friends: [uid] .
213+
loc: geo .
214+
type: string .
215+
coords: float .
211216
212217
type Person {
213-
name: string
214-
age: int
215-
married: bool
216-
Friends: [Person]
217-
loc: [Loc]
218-
}
219-
220-
type Loc {
221-
type: string
222-
coords: float
223-
}
218+
name
219+
age
220+
married
221+
Friends
222+
loc
223+
}
224224
225225
type Institution {
226-
name: string
226+
name
227227
}
228228
`
229229

@@ -343,10 +343,11 @@ func ExampleTxn_Mutate_bytes() {
343343
op := &api.Operation{}
344344
op.Schema = `
345345
name: string @index(exact) .
346+
bytes: string .
346347
347348
type Person {
348-
name: string
349-
bytes: string
349+
name
350+
bytes
350351
}
351352
`
352353

@@ -425,18 +426,20 @@ func ExampleTxn_Query_unmarshal() {
425426
defer cancel()
426427
op := &api.Operation{}
427428
op.Schema = `
429+
name: string @index(exact) .
428430
age: int .
429431
married: bool .
432+
Friends: [uid] .
430433
431434
type Person {
432-
name: string
433-
age: int
434-
married: bool
435-
Friends: [Person]
435+
name
436+
age
437+
married
438+
Friends
436439
}
437440
438441
type Institution {
439-
name: string
442+
name
440443
}
441444
`
442445

@@ -612,23 +615,31 @@ func ExampleTxn_Mutate_facets() {
612615
op = api.Operation{}
613616
op.Schema = `
614617
name: string @index(exact) .
618+
age: int .
619+
married: bool .
620+
NameOrigin: string .
621+
Since: string .
622+
Family: string .
623+
Age: bool .
624+
Close: bool .
625+
Friends: [uid] .
615626
616627
type Person {
617-
name: string
618-
age: int
619-
married: bool
620-
NameOrigin: string
621-
Since: string
622-
Family: string
623-
Age: int
624-
Close: bool
625-
Friends: [Person]
626-
}
628+
name
629+
age
630+
married
631+
NameOrigin
632+
Since
633+
Family
634+
Age
635+
Close
636+
Friends
637+
}
627638
628639
type Institution {
629-
name: string
630-
Since: string
631-
}
640+
name
641+
Since
642+
}
632643
`
633644

634645
err := dg.Alter(ctx, &op)
@@ -796,9 +807,9 @@ func ExampleTxn_Mutate_list() {
796807
phone_number: [int] .
797808
798809
type Person {
799-
Address: [string]
800-
phone_number: [int]
801-
}
810+
Address
811+
phone_number
812+
}
802813
`
803814

804815
ctx := context.Background()
@@ -863,10 +874,14 @@ func ExampleDeleteEdges() {
863874
location: string .
864875
865876
type Person {
866-
name: string
867-
age: int
868-
married: bool
869-
Friends: [Person]
877+
name
878+
age
879+
married
880+
Friends
881+
}
882+
883+
type Institution {
884+
name
870885
}
871886
872887
type Institution {
@@ -1212,8 +1227,10 @@ func ExampleTxn_Mutate_deletePredicate() {
12121227

12131228
op := &api.Operation{}
12141229
op.Schema = `
1230+
name: string .
12151231
age: int .
12161232
married: bool .
1233+
friends: [uid] .
12171234
12181235
type Person {
12191236
name: string

0 commit comments

Comments
 (0)