-
Notifications
You must be signed in to change notification settings - Fork 124
/
Copy pathvariables_test.dart
48 lines (43 loc) · 1.35 KB
/
variables_test.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import 'package:end_to_end_test/graphql/__generated__/schema.schema.gql.dart';
import 'package:end_to_end_test/variables/__generated__/create_review.var.gql.dart';
import 'package:end_to_end_test/variables/__generated__/human_with_args.var.gql.dart';
import "package:test/test.dart";
void main() {
group("Basic Args", () {
final args = GHumanWithArgsVars((b) => b..id = "123");
final json = {
"id": "123",
};
test('basic args object can be serialized / deserialized', () {
expect(args.toJson(), equals(json));
expect(GHumanWithArgsVars.fromJson(json), args);
});
});
group("Complex Args", () {
final args = GCreateReviewVars(
(b) => b
..episode = GEpisode.EMPIRE
..review.stars = 5
..review.commentary = "this was amazing!!!"
..review.favorite_color.blue = 255
..review.favorite_color.green = 120
..review.favorite_color.red = 80,
);
final json = {
"episode": "EMPIRE",
"review": {
"stars": 5,
"commentary": "this was amazing!!!",
"favorite_color": {
"blue": 255,
"green": 120,
"red": 80,
},
},
};
test('complex args object can be serialized / deserialized', () {
expect(args.toJson(), equals(json));
expect(GCreateReviewVars.fromJson(json), args);
});
});
}