@@ -26,6 +26,48 @@ void main() {
26
26
backingMap = profileBackingMaps.lastOrNull! ;
27
27
});
28
28
29
+ group ('HttpProfileRedirectData' , () {
30
+ test ('equal' , () {
31
+ expect (
32
+ HttpProfileRedirectData (
33
+ statusCode: 302 , method: 'GET' , location: 'http://somewhere' ),
34
+ HttpProfileRedirectData (
35
+ statusCode: 302 , method: 'GET' , location: 'http://somewhere' ));
36
+ });
37
+
38
+ test ('not equal' , () {
39
+ expect (
40
+ HttpProfileRedirectData (
41
+ statusCode: 302 , method: 'GET' , location: 'http://somewhere' ),
42
+ isNot (Object ()));
43
+ expect (
44
+ HttpProfileRedirectData (
45
+ statusCode: 302 , method: 'GET' , location: 'http://somewhere' ),
46
+ isNot (HttpProfileRedirectData (
47
+ statusCode: 303 , method: 'GET' , location: 'http://somewhere' )));
48
+ expect (
49
+ HttpProfileRedirectData (
50
+ statusCode: 302 , method: 'GET' , location: 'http://somewhere' ),
51
+ isNot (HttpProfileRedirectData (
52
+ statusCode: 302 , method: 'POST' , location: 'http://somewhere' )));
53
+ expect (
54
+ HttpProfileRedirectData (
55
+ statusCode: 302 , method: 'GET' , location: 'http://somewhere' ),
56
+ isNot (HttpProfileRedirectData (
57
+ statusCode: 302 , method: 'GET' , location: 'http://notthere' )));
58
+ });
59
+
60
+ test ('hash' , () {
61
+ expect (
62
+ HttpProfileRedirectData (
63
+ statusCode: 302 , method: 'GET' , location: 'http://somewhere' )
64
+ .hashCode,
65
+ HttpProfileRedirectData (
66
+ statusCode: 302 , method: 'GET' , location: 'http://somewhere' )
67
+ .hashCode);
68
+ });
69
+ });
70
+
29
71
test ('calling HttpClientRequestProfile.responseData.addRedirect' , () async {
30
72
final responseData = backingMap['responseData' ] as Map <String , dynamic >;
31
73
final redirectsFromBackingMap =
@@ -45,11 +87,13 @@ void main() {
45
87
expect (redirectFromBackingMap['method' ], 'GET' );
46
88
expect (redirectFromBackingMap['location' ], 'https://images.example.com/1' );
47
89
48
- expect (profile.responseData.redirects.length, 1 );
49
- final redirectFromGetter = profile.responseData.redirects.first;
50
- expect (redirectFromGetter.statusCode, 301 );
51
- expect (redirectFromGetter.method, 'GET' );
52
- expect (redirectFromGetter.location, 'https://images.example.com/1' );
90
+ expect (profile.responseData.redirects, [
91
+ HttpProfileRedirectData (
92
+ statusCode: 301 ,
93
+ method: 'GET' ,
94
+ location: 'https://images.example.com/1' ,
95
+ )
96
+ ]);
53
97
});
54
98
55
99
test ('populating HttpClientRequestProfile.responseData.headersListValues' ,
0 commit comments