@@ -3,91 +3,151 @@ import 'package:sentry_flutter/src/method_channel_helper.dart';
3
3
import 'package:collection/collection.dart' ;
4
4
5
5
void main () {
6
- test ('primitives' , () {
7
- var expected = < String , dynamic > {
8
- 'null' : null ,
9
- 'int' : 1 ,
10
- 'float' : 1.1 ,
11
- 'bool' : true ,
12
- 'string' : 'Foo' ,
13
- };
14
-
15
- var actual = MethodChannelHelper .normalizeMap (expected);
16
- expect (
17
- DeepCollectionEquality ().equals (actual, expected),
18
- true ,
19
- );
20
- });
6
+ group ('normalize' , () {
7
+ test ('primitives' , () {
8
+ var expected = < String , dynamic > {
9
+ 'null' : null ,
10
+ 'int' : 1 ,
11
+ 'float' : 1.1 ,
12
+ 'bool' : true ,
13
+ 'string' : 'Foo' ,
14
+ };
15
+
16
+ var actual = MethodChannelHelper .normalizeMap (expected);
17
+ expect (
18
+ DeepCollectionEquality ().equals (actual, expected),
19
+ true ,
20
+ );
21
+
22
+ expect (MethodChannelHelper .normalize (null ), null );
23
+ expect (MethodChannelHelper .normalize (1 ), 1 );
24
+ expect (MethodChannelHelper .normalize (1.1 ), 1.1 );
25
+ expect (MethodChannelHelper .normalize (true ), true );
26
+ expect (MethodChannelHelper .normalize ('Foo' ), 'Foo' );
27
+ });
28
+
29
+ test ('object' , () {
30
+ expect (MethodChannelHelper .normalize (_CustomObject ()), 'CustomObject()' );
31
+ });
32
+
33
+ test ('object in list' , () {
34
+ var input = < String , dynamic > {
35
+ 'object' : [_CustomObject ()]
36
+ };
37
+ var expected = < String , dynamic > {
38
+ 'object' : ['CustomObject()' ]
39
+ };
40
+
41
+ var actual = MethodChannelHelper .normalize (input);
42
+ expect (
43
+ DeepCollectionEquality ().equals (actual, expected),
44
+ true ,
45
+ );
46
+ });
21
47
22
- test ('list with primitives' , () {
23
- var expected = < String , dynamic > {
24
- 'list' : [null , 1 , 1.1 , true , 'Foo' ],
25
- };
48
+ test ('object in map' , () {
49
+ var input = < String , dynamic > {
50
+ 'object' : < String , dynamic > {'object' : _CustomObject ()}
51
+ };
52
+ var expected = < String , dynamic > {
53
+ 'object' : < String , dynamic > {'object' : 'CustomObject()' }
54
+ };
26
55
27
- var actual = MethodChannelHelper .normalizeMap (expected);
28
- expect (
29
- DeepCollectionEquality ().equals (actual, expected),
30
- true ,
31
- );
56
+ var actual = MethodChannelHelper .normalize (input);
57
+ expect (
58
+ DeepCollectionEquality ().equals (actual, expected),
59
+ true ,
60
+ );
61
+ });
32
62
});
33
63
34
- test ( 'map with primitives ' , () {
35
- var expected = < String , dynamic > {
36
- 'map' : < String , dynamic > {
64
+ group ( 'normalizeMap ' , () {
65
+ test ( 'primitives' , () {
66
+ var expected = < String , dynamic > {
37
67
'null' : null ,
38
68
'int' : 1 ,
39
69
'float' : 1.1 ,
40
70
'bool' : true ,
41
71
'string' : 'Foo' ,
42
- },
43
- };
44
-
45
- var actual = MethodChannelHelper .normalizeMap (expected);
46
- expect (
47
- DeepCollectionEquality ().equals (actual, expected),
48
- true ,
49
- );
50
- });
72
+ };
51
73
52
- test ('object' , () {
53
- var input = < String , dynamic > {'object' : _CustomObject ()};
54
- var expected = < String , dynamic > {'object' : 'CustomObject()' };
74
+ var actual = MethodChannelHelper .normalizeMap (expected);
75
+ expect (
76
+ DeepCollectionEquality ().equals (actual, expected),
77
+ true ,
78
+ );
79
+ });
55
80
56
- var actual = MethodChannelHelper .normalizeMap (input);
57
- expect (
58
- DeepCollectionEquality ().equals (actual, expected),
59
- true ,
60
- );
61
- });
81
+ test ('list with primitives' , () {
82
+ var expected = < String , dynamic > {
83
+ 'list' : [null , 1 , 1.1 , true , 'Foo' ],
84
+ };
62
85
63
- test ('object in list' , () {
64
- var input = < String , dynamic > {
65
- 'object' : [_CustomObject ()]
66
- };
67
- var expected = < String , dynamic > {
68
- 'object' : ['CustomObject()' ]
69
- };
70
-
71
- var actual = MethodChannelHelper .normalizeMap (input);
72
- expect (
73
- DeepCollectionEquality ().equals (actual, expected),
74
- true ,
75
- );
76
- });
86
+ var actual = MethodChannelHelper .normalizeMap (expected);
87
+ expect (
88
+ DeepCollectionEquality ().equals (actual, expected),
89
+ true ,
90
+ );
91
+ });
92
+
93
+ test ('map with primitives' , () {
94
+ var expected = < String , dynamic > {
95
+ 'map' : < String , dynamic > {
96
+ 'null' : null ,
97
+ 'int' : 1 ,
98
+ 'float' : 1.1 ,
99
+ 'bool' : true ,
100
+ 'string' : 'Foo' ,
101
+ },
102
+ };
103
+
104
+ var actual = MethodChannelHelper .normalizeMap (expected);
105
+ expect (
106
+ DeepCollectionEquality ().equals (actual, expected),
107
+ true ,
108
+ );
109
+ });
110
+
111
+ test ('object' , () {
112
+ var input = < String , dynamic > {'object' : _CustomObject ()};
113
+ var expected = < String , dynamic > {'object' : 'CustomObject()' };
114
+
115
+ var actual = MethodChannelHelper .normalizeMap (input);
116
+ expect (
117
+ DeepCollectionEquality ().equals (actual, expected),
118
+ true ,
119
+ );
120
+ });
121
+
122
+ test ('object in list' , () {
123
+ var input = < String , dynamic > {
124
+ 'object' : [_CustomObject ()]
125
+ };
126
+ var expected = < String , dynamic > {
127
+ 'object' : ['CustomObject()' ]
128
+ };
129
+
130
+ var actual = MethodChannelHelper .normalizeMap (input);
131
+ expect (
132
+ DeepCollectionEquality ().equals (actual, expected),
133
+ true ,
134
+ );
135
+ });
136
+
137
+ test ('object in map' , () {
138
+ var input = < String , dynamic > {
139
+ 'object' : < String , dynamic > {'object' : _CustomObject ()}
140
+ };
141
+ var expected = < String , dynamic > {
142
+ 'object' : < String , dynamic > {'object' : 'CustomObject()' }
143
+ };
77
144
78
- test ('object in map' , () {
79
- var input = < String , dynamic > {
80
- 'object' : < String , dynamic > {'object' : _CustomObject ()}
81
- };
82
- var expected = < String , dynamic > {
83
- 'object' : < String , dynamic > {'object' : 'CustomObject()' }
84
- };
85
-
86
- var actual = MethodChannelHelper .normalizeMap (input);
87
- expect (
88
- DeepCollectionEquality ().equals (actual, expected),
89
- true ,
90
- );
145
+ var actual = MethodChannelHelper .normalizeMap (input);
146
+ expect (
147
+ DeepCollectionEquality ().equals (actual, expected),
148
+ true ,
149
+ );
150
+ });
91
151
});
92
152
}
93
153
0 commit comments