@@ -79,86 +79,119 @@ void main() {
79
79
});
80
80
});
81
81
82
- test ('Breadcrumb http ctor' , () {
83
- final breadcrumb = Breadcrumb .http (
84
- url: Uri .parse ('https://example.org' ),
85
- method: 'GET' ,
86
- level: SentryLevel .fatal,
87
- reason: 'OK' ,
88
- statusCode: 200 ,
89
- requestDuration: Duration .zero,
90
- timestamp: DateTime .now (),
91
- requestBodySize: 2 ,
92
- responseBodySize: 3 ,
93
- );
94
- final json = breadcrumb.toJson ();
95
-
96
- expect (json, {
97
- 'timestamp' : formatDateAsIso8601WithMillisPrecision (breadcrumb.timestamp),
98
- 'category' : 'http' ,
99
- 'data' : {
100
- 'url' : 'https://example.org' ,
101
- 'method' : 'GET' ,
102
- 'status_code' : 200 ,
103
- 'reason' : 'OK' ,
104
- 'duration' : '0:00:00.000000' ,
105
- 'request_body_size' : 2 ,
106
- 'response_body_size' : 3 ,
107
- },
108
- 'level' : 'fatal' ,
109
- 'type' : 'http' ,
82
+ group ('ctor' , () {
83
+ test ('Breadcrumb http' , () {
84
+ final breadcrumb = Breadcrumb .http (
85
+ url: Uri .parse ('https://example.org' ),
86
+ method: 'GET' ,
87
+ level: SentryLevel .fatal,
88
+ reason: 'OK' ,
89
+ statusCode: 200 ,
90
+ requestDuration: Duration .zero,
91
+ timestamp: DateTime .now (),
92
+ requestBodySize: 2 ,
93
+ responseBodySize: 3 ,
94
+ );
95
+ final json = breadcrumb.toJson ();
96
+
97
+ expect (json, {
98
+ 'timestamp' :
99
+ formatDateAsIso8601WithMillisPrecision (breadcrumb.timestamp),
100
+ 'category' : 'http' ,
101
+ 'data' : {
102
+ 'url' : 'https://example.org' ,
103
+ 'method' : 'GET' ,
104
+ 'status_code' : 200 ,
105
+ 'reason' : 'OK' ,
106
+ 'duration' : '0:00:00.000000' ,
107
+ 'request_body_size' : 2 ,
108
+ 'response_body_size' : 3 ,
109
+ },
110
+ 'level' : 'fatal' ,
111
+ 'type' : 'http' ,
112
+ });
110
113
});
111
- });
112
114
113
- test ('Minimal Breadcrumb http ctor' , () {
114
- final breadcrumb = Breadcrumb .http (
115
- url: Uri .parse ('https://example.org' ),
116
- method: 'GET' ,
117
- );
118
- final json = breadcrumb.toJson ();
119
-
120
- expect (json, {
121
- 'timestamp' : formatDateAsIso8601WithMillisPrecision (breadcrumb.timestamp),
122
- 'category' : 'http' ,
123
- 'data' : {
124
- 'url' : 'https://example.org' ,
125
- 'method' : 'GET' ,
126
- },
127
- 'level' : 'info' ,
128
- 'type' : 'http' ,
115
+ test ('Minimal Breadcrumb http' , () {
116
+ final breadcrumb = Breadcrumb .http (
117
+ url: Uri .parse ('https://example.org' ),
118
+ method: 'GET' ,
119
+ );
120
+ final json = breadcrumb.toJson ();
121
+
122
+ expect (json, {
123
+ 'timestamp' :
124
+ formatDateAsIso8601WithMillisPrecision (breadcrumb.timestamp),
125
+ 'category' : 'http' ,
126
+ 'data' : {
127
+ 'url' : 'https://example.org' ,
128
+ 'method' : 'GET' ,
129
+ },
130
+ 'level' : 'info' ,
131
+ 'type' : 'http' ,
132
+ });
129
133
});
130
- });
131
134
132
- test ('Breadcrumb console ctor' , () {
133
- final breadcrumb = Breadcrumb .console (
134
- message: 'Foo Bar' ,
135
- );
136
- final json = breadcrumb.toJson ();
137
-
138
- expect (json, {
139
- 'message' : 'Foo Bar' ,
140
- 'timestamp' : formatDateAsIso8601WithMillisPrecision (breadcrumb.timestamp),
141
- 'category' : 'console' ,
142
- 'type' : 'debug' ,
143
- 'level' : 'info' ,
135
+ test ('Breadcrumb console' , () {
136
+ final breadcrumb = Breadcrumb .console (
137
+ message: 'Foo Bar' ,
138
+ );
139
+ final json = breadcrumb.toJson ();
140
+
141
+ expect (json, {
142
+ 'message' : 'Foo Bar' ,
143
+ 'timestamp' :
144
+ formatDateAsIso8601WithMillisPrecision (breadcrumb.timestamp),
145
+ 'category' : 'console' ,
146
+ 'type' : 'debug' ,
147
+ 'level' : 'info' ,
148
+ });
144
149
});
145
- });
146
150
147
- test ('extensive Breadcrumb console ctor' , () {
148
- final breadcrumb = Breadcrumb .console (
149
- message: 'Foo Bar' ,
150
- level: SentryLevel .error,
151
- data: {'foo' : 'bar' },
152
- );
153
- final json = breadcrumb.toJson ();
154
-
155
- expect (json, {
156
- 'message' : 'Foo Bar' ,
157
- 'timestamp' : formatDateAsIso8601WithMillisPrecision (breadcrumb.timestamp),
158
- 'category' : 'console' ,
159
- 'type' : 'debug' ,
160
- 'level' : 'error' ,
161
- 'data' : {'foo' : 'bar' },
151
+ test ('extensive Breadcrumb console' , () {
152
+ final breadcrumb = Breadcrumb .console (
153
+ message: 'Foo Bar' ,
154
+ level: SentryLevel .error,
155
+ data: {'foo' : 'bar' },
156
+ );
157
+ final json = breadcrumb.toJson ();
158
+
159
+ expect (json, {
160
+ 'message' : 'Foo Bar' ,
161
+ 'timestamp' :
162
+ formatDateAsIso8601WithMillisPrecision (breadcrumb.timestamp),
163
+ 'category' : 'console' ,
164
+ 'type' : 'debug' ,
165
+ 'level' : 'error' ,
166
+ 'data' : {'foo' : 'bar' },
167
+ });
168
+ });
169
+
170
+ test ('extensive Breadcrumb user interaction' , () {
171
+ final time = DateTime .now ().toUtc ();
172
+ final breadcrumb = Breadcrumb .userInteraction (
173
+ message: 'Foo Bar' ,
174
+ level: SentryLevel .error,
175
+ timestamp: time,
176
+ data: {'foo' : 'bar' },
177
+ subCategory: 'click' ,
178
+ viewId: 'foo' ,
179
+ viewClass: 'bar' ,
180
+ );
181
+ final json = breadcrumb.toJson ();
182
+
183
+ expect (json, {
184
+ 'message' : 'Foo Bar' ,
185
+ 'timestamp' : formatDateAsIso8601WithMillisPrecision (time),
186
+ 'category' : 'ui.click' ,
187
+ 'type' : 'user' ,
188
+ 'level' : 'error' ,
189
+ 'data' : {
190
+ 'foo' : 'bar' ,
191
+ 'view.id' : 'foo' ,
192
+ 'view.class' : 'bar' ,
193
+ },
194
+ });
162
195
});
163
196
});
164
197
}
0 commit comments