@@ -45,7 +45,7 @@ void main() async {
45
45
Map <String , dynamic > emptyMap = {};
46
46
String payloadJson = '{"data":{},"errors":[]}' ;
47
47
48
- mockAPIPlugin.queryMethod = < String > (GraphQLRequest mockRequest) {
48
+ mockAPIPlugin.queryMethod = < T > (GraphQLRequest mockRequest) {
49
49
expect (mockRequest.document, document);
50
50
expect (mockRequest.variables, emptyMap);
51
51
expect (mockRequest.apiName, null );
@@ -54,10 +54,10 @@ void main() async {
54
54
expect (mockRequest.decodePath, null );
55
55
expect (mockRequest.modelType, null );
56
56
57
- return GraphQLOperation <String >(
58
- CancelableOperation <GraphQLResponse <String >>.fromValue (
59
- GraphQLResponse <String >(
60
- data: null as String ? ,
57
+ return GraphQLOperation <T >(
58
+ CancelableOperation <GraphQLResponse <T >>.fromValue (
59
+ GraphQLResponse <T >(
60
+ data: null as T ? ,
61
61
errors: [],
62
62
),
63
63
),
@@ -91,7 +91,7 @@ void main() async {
91
91
'{"data":$data ,"errors":[{"message":"$errorMessage1 "},{"message":"$errorMessage2 "}]}' ;
92
92
String authMode = 'apiKey' ;
93
93
94
- mockAPIPlugin.queryMethod = < String > (GraphQLRequest mockRequest) {
94
+ mockAPIPlugin.queryMethod = < T > (GraphQLRequest mockRequest) {
95
95
expect (mockRequest.id.length, greaterThan (0 ));
96
96
expect (mockRequest.document, document);
97
97
expect (mockRequest.variables[variable1Key], variable1Value);
@@ -102,10 +102,10 @@ void main() async {
102
102
expect (mockRequest.decodePath, null );
103
103
expect (mockRequest.modelType, null );
104
104
105
- return GraphQLOperation <String >(
106
- CancelableOperation <GraphQLResponse <String >>.fromValue (
107
- GraphQLResponse <String >(
108
- data: data as String ? ,
105
+ return GraphQLOperation <T >(
106
+ CancelableOperation <GraphQLResponse <T >>.fromValue (
107
+ GraphQLResponse <T >(
108
+ data: data as T ? ,
109
109
errors: [
110
110
GraphQLResponseError (message: errorMessage1),
111
111
GraphQLResponseError (message: errorMessage2),
@@ -137,7 +137,7 @@ void main() async {
137
137
String payloadJson =
138
138
'{"data":{},"errors":[{"message":"Error parsing payload json: FormatException: Unexpected character (at character 1)\\ nInvalid Json\\ n^\\ n"}]}' ;
139
139
140
- mockAPIPlugin.queryMethod = < String > (GraphQLRequest mockRequest) {
140
+ mockAPIPlugin.queryMethod = < T > (GraphQLRequest mockRequest) {
141
141
expect (mockRequest.document, document);
142
142
expect (mockRequest.variables, emptyMap);
143
143
expect (mockRequest.apiName, null );
@@ -146,10 +146,10 @@ void main() async {
146
146
expect (mockRequest.decodePath, null );
147
147
expect (mockRequest.modelType, null );
148
148
149
- return GraphQLOperation <String >(
150
- CancelableOperation <GraphQLResponse <String >>.fromValue (
151
- GraphQLResponse <String >(
152
- data: data as String ? ,
149
+ return GraphQLOperation <T >(
150
+ CancelableOperation <GraphQLResponse <T >>.fromValue (
151
+ GraphQLResponse <T >(
152
+ data: data as T ? ,
153
153
errors: [],
154
154
),
155
155
),
@@ -168,13 +168,13 @@ void main() async {
168
168
String ? authMode,
169
169
APIAuthorizationType ? expected,
170
170
) async {
171
- mockAPIPlugin.queryMethod = < String > (GraphQLRequest mockRequest) {
171
+ mockAPIPlugin.queryMethod = < T > (GraphQLRequest mockRequest) {
172
172
expect (mockRequest.authorizationMode, expected);
173
173
174
- return GraphQLOperation <String >(
175
- CancelableOperation <GraphQLResponse <String >>.fromValue (
176
- GraphQLResponse <String >(
177
- data: null as String ? ,
174
+ return GraphQLOperation <T >(
175
+ CancelableOperation <GraphQLResponse <T >>.fromValue (
176
+ GraphQLResponse <T >(
177
+ data: null as T ? ,
178
178
errors: [],
179
179
),
180
180
),
@@ -223,7 +223,7 @@ void main() async {
223
223
String payloadJson =
224
224
'{"errors":[{"message":"NetworkException {\\ n \\ "message\\ ": \\ "API Exception\\ "\\ n}"}]}' ;
225
225
226
- mockAPIPlugin.queryMethod = < String > (GraphQLRequest mockRequest) {
226
+ mockAPIPlugin.queryMethod = < T > (GraphQLRequest mockRequest) {
227
227
throw NetworkException (exceptionMessage);
228
228
};
229
229
@@ -243,7 +243,7 @@ void main() async {
243
243
String payloadJson =
244
244
'{"errors":[{"message":"Unauthorized - API Exception - SignedOutException"}]}' ;
245
245
246
- mockAPIPlugin.queryMethod = < String > (GraphQLRequest mockRequest) {
246
+ mockAPIPlugin.queryMethod = < T > (GraphQLRequest mockRequest) {
247
247
throw NetworkException (
248
248
exceptionMessage,
249
249
underlyingException: 'SignedOutException' ,
@@ -267,7 +267,7 @@ void main() async {
267
267
String payloadJson =
268
268
'{"errors":[{"message":"NetworkException {\\ n \\ "message\\ ": \\ "$exceptionMessage \\ ",\\ n \\ "underlyingException\\ ": \\ "Unauthrorized\\ "\\ n}"}]}' ;
269
269
270
- mockAPIPlugin.queryMethod = < String > (GraphQLRequest mockRequest) {
270
+ mockAPIPlugin.queryMethod = < T > (GraphQLRequest mockRequest) {
271
271
throw NetworkException (
272
272
exceptionMessage,
273
273
underlyingException: 'Unauthrorized' ,
@@ -291,7 +291,7 @@ void main() async {
291
291
Map <String , dynamic > emptyMap = {};
292
292
String payloadJson = '{"data":{},"errors":[]}' ;
293
293
294
- mockAPIPlugin.mutateMethod = < String > (GraphQLRequest mockRequest) {
294
+ mockAPIPlugin.mutateMethod = < T > (GraphQLRequest mockRequest) {
295
295
expect (mockRequest.document, document);
296
296
expect (mockRequest.variables, emptyMap);
297
297
expect (mockRequest.apiName, null );
@@ -300,10 +300,10 @@ void main() async {
300
300
expect (mockRequest.decodePath, null );
301
301
expect (mockRequest.modelType, null );
302
302
303
- return GraphQLOperation <String >(
304
- CancelableOperation <GraphQLResponse <String >>.fromValue (
305
- GraphQLResponse <String >(
306
- data: null as String ? ,
303
+ return GraphQLOperation <T >(
304
+ CancelableOperation <GraphQLResponse <T >>.fromValue (
305
+ GraphQLResponse <T >(
306
+ data: null as T ? ,
307
307
errors: [],
308
308
),
309
309
),
@@ -337,7 +337,7 @@ void main() async {
337
337
String payloadJson =
338
338
'{"data":$data ,"errors":[{"message":"$errorMessage1 "},{"message":"$errorMessage2 "}]}' ;
339
339
340
- mockAPIPlugin.mutateMethod = < String > (GraphQLRequest mockRequest) {
340
+ mockAPIPlugin.mutateMethod = < T > (GraphQLRequest mockRequest) {
341
341
expect (mockRequest.id.length, greaterThan (0 ));
342
342
expect (mockRequest.document, document);
343
343
expect (mockRequest.variables[variable1Key], variable1Value);
@@ -348,10 +348,10 @@ void main() async {
348
348
expect (mockRequest.decodePath, null );
349
349
expect (mockRequest.modelType, null );
350
350
351
- return GraphQLOperation <String >(
352
- CancelableOperation <GraphQLResponse <String >>.fromValue (
353
- GraphQLResponse <String >(
354
- data: data as String ? ,
351
+ return GraphQLOperation <T >(
352
+ CancelableOperation <GraphQLResponse <T >>.fromValue (
353
+ GraphQLResponse <T >(
354
+ data: data as T ? ,
355
355
errors: [
356
356
GraphQLResponseError (message: errorMessage1),
357
357
GraphQLResponseError (message: errorMessage2),
@@ -384,7 +384,7 @@ void main() async {
384
384
String payloadJson =
385
385
'{"data":{},"errors":[{"message":"Error parsing payload json: FormatException: Unexpected character (at character 1)\\ nInvalid Json\\ n^\\ n"}]}' ;
386
386
387
- mockAPIPlugin.mutateMethod = < String > (GraphQLRequest mockRequest) {
387
+ mockAPIPlugin.mutateMethod = < T > (GraphQLRequest mockRequest) {
388
388
expect (mockRequest.document, document);
389
389
expect (mockRequest.variables, emptyMap);
390
390
expect (mockRequest.apiName, null );
@@ -393,10 +393,10 @@ void main() async {
393
393
expect (mockRequest.decodePath, null );
394
394
expect (mockRequest.modelType, null );
395
395
396
- return GraphQLOperation <String >(
397
- CancelableOperation <GraphQLResponse <String >>.fromValue (
398
- GraphQLResponse <String >(
399
- data: data as String ? ,
396
+ return GraphQLOperation <T >(
397
+ CancelableOperation <GraphQLResponse <T >>.fromValue (
398
+ GraphQLResponse <T >(
399
+ data: data as T ? ,
400
400
errors: [],
401
401
),
402
402
),
@@ -416,7 +416,7 @@ void main() async {
416
416
String payloadJson =
417
417
'{"errors":[{"message":"NetworkException {\\ n \\ "message\\ ": \\ "API Exception\\ "\\ n}"}]}' ;
418
418
419
- mockAPIPlugin.mutateMethod = < String > (GraphQLRequest mockRequest) {
419
+ mockAPIPlugin.mutateMethod = < T > (GraphQLRequest mockRequest) {
420
420
throw NetworkException (exceptionMessage);
421
421
};
422
422
@@ -436,7 +436,7 @@ void main() async {
436
436
String payloadJson =
437
437
'{"errors":[{"message":"Unauthorized - API Exception - SignedOutException"}]}' ;
438
438
439
- mockAPIPlugin.mutateMethod = < String > (GraphQLRequest mockRequest) {
439
+ mockAPIPlugin.mutateMethod = < T > (GraphQLRequest mockRequest) {
440
440
throw NetworkException (
441
441
exceptionMessage,
442
442
underlyingException: 'SignedOutException' ,
@@ -460,7 +460,7 @@ void main() async {
460
460
String payloadJson =
461
461
'{"errors":[{"message":"NetworkException {\\ n \\ "message\\ ": \\ "$exceptionMessage \\ ",\\ n \\ "underlyingException\\ ": \\ "Unauthrorized\\ "\\ n}"}]}' ;
462
462
463
- mockAPIPlugin.mutateMethod = < String > (GraphQLRequest mockRequest) {
463
+ mockAPIPlugin.mutateMethod = < T > (GraphQLRequest mockRequest) {
464
464
throw NetworkException (
465
465
exceptionMessage,
466
466
underlyingException: 'Unauthrorized' ,
@@ -484,7 +484,7 @@ void main() async {
484
484
String document = '' ;
485
485
Map <String , dynamic > emptyMap = {};
486
486
487
- mockAPIPlugin.subscribeMethod = < String > (
487
+ mockAPIPlugin.subscribeMethod = < T > (
488
488
GraphQLRequest mockRequest,
489
489
void Function ()? onEstablished,
490
490
) {
@@ -496,7 +496,7 @@ void main() async {
496
496
expect (mockRequest.decodePath, null );
497
497
expect (mockRequest.modelType, null );
498
498
499
- var controller = StreamController <GraphQLResponse <String >>();
499
+ var controller = StreamController <GraphQLResponse <T >>();
500
500
return controller.stream;
501
501
};
502
502
@@ -525,7 +525,7 @@ void main() async {
525
525
String decodePath = 'decodePath' ;
526
526
String options = 'options' ;
527
527
528
- mockAPIPlugin.subscribeMethod = < String > (
528
+ mockAPIPlugin.subscribeMethod = < T > (
529
529
GraphQLRequest mockRequest,
530
530
void Function ()? onEstablished,
531
531
) {
@@ -539,7 +539,7 @@ void main() async {
539
539
expect (mockRequest.decodePath, null );
540
540
expect (mockRequest.modelType, null );
541
541
542
- var controller = StreamController <GraphQLResponse <String >>();
542
+ var controller = StreamController <GraphQLResponse <T >>();
543
543
return controller.stream;
544
544
};
545
545
@@ -580,7 +580,7 @@ void main() async {
580
580
test ('Should handle API exception' , () async {
581
581
String exceptionMessage = 'API Exception' ;
582
582
583
- mockAPIPlugin.subscribeMethod = < String > (
583
+ mockAPIPlugin.subscribeMethod = < T > (
584
584
GraphQLRequest mockRequest,
585
585
void Function ()? onEstablished,
586
586
) {
@@ -605,12 +605,12 @@ void main() async {
605
605
test ('Should handle established/connected callback' , () async {
606
606
void Function ()? onEstablishedCallback;
607
607
608
- mockAPIPlugin.subscribeMethod = < String > (
608
+ mockAPIPlugin.subscribeMethod = < T > (
609
609
GraphQLRequest mockRequest,
610
610
void Function ()? onEstablished,
611
611
) {
612
612
onEstablishedCallback = onEstablished;
613
- var controller = StreamController <GraphQLResponse <String >>();
613
+ var controller = StreamController <GraphQLResponse <T >>();
614
614
return controller.stream;
615
615
};
616
616
@@ -649,11 +649,11 @@ void main() async {
649
649
String payloadJson = '{"data":$data ,"errors":[]}' ;
650
650
StreamController ? responseController;
651
651
652
- mockAPIPlugin.subscribeMethod = < String > (
652
+ mockAPIPlugin.subscribeMethod = < T > (
653
653
GraphQLRequest mockRequest,
654
654
void Function ()? onEstablished,
655
655
) {
656
- var controller = StreamController <GraphQLResponse <String >>();
656
+ var controller = StreamController <GraphQLResponse <T >>();
657
657
responseController = controller;
658
658
return controller.stream;
659
659
};
@@ -703,11 +703,11 @@ void main() async {
703
703
704
704
StreamController ? responseController;
705
705
706
- mockAPIPlugin.subscribeMethod = < String > (
706
+ mockAPIPlugin.subscribeMethod = < T > (
707
707
GraphQLRequest mockRequest,
708
708
void Function ()? onEstablished,
709
709
) {
710
- var controller = StreamController <GraphQLResponse <String >>();
710
+ var controller = StreamController <GraphQLResponse <T >>();
711
711
responseController = controller;
712
712
return controller.stream;
713
713
};
@@ -757,11 +757,11 @@ void main() async {
757
757
'{"data":{},"errors":[{"message":"Error parsing payload json: FormatException: Unexpected character (at character 1)\\ nInvalid Json\\ n^\\ n"}]}' ;
758
758
StreamController ? responseController;
759
759
760
- mockAPIPlugin.subscribeMethod = < String > (
760
+ mockAPIPlugin.subscribeMethod = < T > (
761
761
GraphQLRequest mockRequest,
762
762
void Function ()? onEstablished,
763
763
) {
764
- var controller = StreamController <GraphQLResponse <String >>();
764
+ var controller = StreamController <GraphQLResponse <T >>();
765
765
responseController = controller;
766
766
return controller.stream;
767
767
};
@@ -809,11 +809,11 @@ void main() async {
809
809
810
810
StreamController ? responseController;
811
811
812
- mockAPIPlugin.subscribeMethod = < String > (
812
+ mockAPIPlugin.subscribeMethod = < T > (
813
813
GraphQLRequest mockRequest,
814
814
void Function ()? onEstablished,
815
815
) {
816
- var controller = StreamController <GraphQLResponse <String >>();
816
+ var controller = StreamController <GraphQLResponse <T >>();
817
817
responseController = controller;
818
818
return controller.stream;
819
819
};
@@ -852,11 +852,11 @@ void main() async {
852
852
test ('Should handle send done event' , () async {
853
853
StreamController ? responseController;
854
854
855
- mockAPIPlugin.subscribeMethod = < String > (
855
+ mockAPIPlugin.subscribeMethod = < T > (
856
856
GraphQLRequest mockRequest,
857
857
void Function ()? onEstablished,
858
858
) {
859
- var controller = StreamController <GraphQLResponse <String >>();
859
+ var controller = StreamController <GraphQLResponse <T >>();
860
860
responseController = controller;
861
861
return controller.stream;
862
862
};
@@ -894,11 +894,11 @@ void main() async {
894
894
895
895
group ('Unubscribe' , () {
896
896
test ('Should handle existing subscription' , () async {
897
- mockAPIPlugin.subscribeMethod = < String > (
897
+ mockAPIPlugin.subscribeMethod = < T > (
898
898
GraphQLRequest mockRequest,
899
899
void Function ()? onEstablished,
900
900
) {
901
- var controller = StreamController <GraphQLResponse <String >>();
901
+ var controller = StreamController <GraphQLResponse <T >>();
902
902
return controller.stream;
903
903
};
904
904
0 commit comments