@@ -13,7 +13,10 @@ fn skip_serializing_none() {
13
13
use skip_serializing_none_mutation:: * ;
14
14
15
15
let query = SkipSerializingNoneMutation :: build_query ( Variables {
16
- foo : None ,
16
+ optional_int : None ,
17
+ optional_list : None ,
18
+ non_optional_int : 1337 ,
19
+ non_optional_list : vec ! [ ] ,
17
20
param : Some ( Param {
18
21
data : Author {
19
22
name : "test" . to_owned ( ) ,
@@ -26,10 +29,17 @@ fn skip_serializing_none() {
26
29
27
30
println ! ( "{}" , stringified) ;
28
31
29
- assert ! ( stringified. contains( r#""variables":{"param":{"data":{"name":"test"}}}"# ) ) ;
32
+ assert ! ( stringified. contains( r#""param":{"data":{"name":"test"}}"# ) ) ;
33
+ assert ! ( stringified. contains( r#""nonOptionalInt":1337"# ) ) ;
34
+ assert ! ( stringified. contains( r#""nonOptionalList":[]"# ) ) ;
35
+ assert ! ( !stringified. contains( r#""optionalInt""# ) ) ;
36
+ assert ! ( !stringified. contains( r#""optionalLint""# ) ) ;
30
37
31
38
let query = SkipSerializingNoneMutation :: build_query ( Variables {
32
- foo : Some ( 42 ) ,
39
+ optional_int : Some ( 42 ) ,
40
+ optional_list : Some ( vec ! [ ] ) ,
41
+ non_optional_int : 1337 ,
42
+ non_optional_list : vec ! [ ] ,
33
43
param : Some ( Param {
34
44
data : Author {
35
45
name : "test" . to_owned ( ) ,
@@ -39,5 +49,9 @@ fn skip_serializing_none() {
39
49
} ) ;
40
50
let stringified = serde_json:: to_string ( & query) . expect ( "SkipSerializingNoneMutation is valid" ) ;
41
51
println ! ( "{}" , stringified) ;
42
- assert ! ( stringified. contains( r#""variables":{"param":{"data":{"name":"test"}},"foo":42}"# ) ) ;
52
+ assert ! ( stringified. contains( r#""param":{"data":{"name":"test"}}"# ) ) ;
53
+ assert ! ( stringified. contains( r#""nonOptionalInt":1337"# ) ) ;
54
+ assert ! ( stringified. contains( r#""nonOptionalList":[]"# ) ) ;
55
+ assert ! ( stringified. contains( r#""optionalInt":42"# ) ) ;
56
+ assert ! ( stringified. contains( r#""optionalList":[]"# ) ) ;
43
57
}
0 commit comments