@@ -13,19 +13,40 @@ const requestsFile = path.join(path.dirname(__dirname), "operations.graphql");
13
13
const requests = fs . readFileSync ( requestsFile , "utf8" ) . toString ( ) ;
14
14
15
15
describe ( testDescription , function ( ) {
16
+
16
17
const tests = [
18
+ {
19
+ label : "fetch all customers" ,
20
+ query : requests ,
21
+ operationName : "GetAllCustomers" ,
22
+ variables : { } ,
23
+ expected : {
24
+ getAllCustomers : [
25
+ { id :
"1" , name :
"Lucas Bill " , email :
"[email protected] " } ,
26
+ { id :
"2" , name :
"Mandy Jones " , email :
"[email protected] " } ,
27
+ { id :
"3" , name :
"Salim Ali " , email :
"[email protected] " } ,
28
+ { id :
"4" , name :
"Jane Xiu " , email :
"[email protected] " } ,
29
+ { id :
"5" , name :
"John Doe " , email :
"[email protected] " } ,
30
+ { id :
"6" , name :
"Jane Smith " , email :
"[email protected] " } ,
31
+ { id :
"7" , name :
"Sandeep Bhushan " , email :
"[email protected] " } ,
32
+ { id :
"8" , name :
"George Han " , email :
"[email protected] " } ,
33
+ { id :
"9" , name :
"Asha Kumari " , email :
"[email protected] " } ,
34
+ { id :
"10" , name :
"Salma Khan " , email :
"[email protected] " }
35
+ ]
36
+ } ,
37
+ } ,
17
38
{
18
39
label : "fetch customer by ID" ,
19
40
query : requests ,
20
41
operationName : "GetCustomerById" ,
21
42
variables : {
22
- id : 1
43
+ id : 1
23
44
} ,
24
45
expected : {
25
46
getCustomerById : {
26
47
id : "1" ,
27
- name : "Lucas Bill" ,
28
-
48
+ name : "Lucas Bill " ,
49
+ email : "lucas.bill @example.com "
29
50
}
30
51
} ,
31
52
} ,
@@ -38,21 +59,16 @@ describe(testDescription, function () {
38
59
} ,
39
60
expected : {
40
61
searchCustomersByName : [
41
- {
42
- id : "2" ,
43
- name : "John Doe" ,
44
-
45
- } ,
46
- {
62
+ {
47
63
id : "5" ,
48
- name : "Johnny Smith " ,
49
-
64
+
65
+ name : "John Doe "
50
66
}
51
67
]
52
68
} ,
53
69
} ,
54
70
] ;
55
-
71
+
56
72
// Run the tests against the deployed schema
57
73
return deployAndRun ( __dirname , tests , stepzen . admin ) ;
58
74
} ) ;
0 commit comments