@@ -62,6 +62,37 @@ void main() {
62
62
expect (getValidRequestUri (url1, []), (uri1Expected, null ));
63
63
});
64
64
65
+ test ('Testing getValidRequestUri with IP URL without port or path' , () {
66
+ String url1 = "8.8.8.8" ;
67
+ Uri uri1Expected = Uri (scheme: 'http' , host: '8.8.8.8' );
68
+ expect (getValidRequestUri (url1, []), (uri1Expected, null ));
69
+ });
70
+
71
+ test ('Testing getValidRequestUri with IP URL with port' , () {
72
+ String url1 = "8.8.8.8:8080" ;
73
+ Uri uri1Expected = Uri (scheme: 'http' , host: '8.8.8.8' , port: 8080 );
74
+ expect (getValidRequestUri (url1, []), (uri1Expected, null ));
75
+ });
76
+
77
+ test ('Testing getValidRequestUri with IP URL with port and path' , () {
78
+ String url1 = "8.8.8.8:8080/hello" ;
79
+ Uri uri1Expected =
80
+ Uri (scheme: 'http' , host: '8.8.8.8' , port: 8080 , path: '/hello' );
81
+ expect (getValidRequestUri (url1, []), (uri1Expected, null ));
82
+ });
83
+
84
+ test ('Testing getValidRequestUri with IP URL with http prefix' , () {
85
+ String url1 = "http://8.8.8.8:3080" ;
86
+ Uri uri1Expected = Uri (scheme: 'http' , host: '8.8.8.8' , port: 3080 );
87
+ expect (getValidRequestUri (url1, []), (uri1Expected, null ));
88
+ });
89
+
90
+ test ('Testing getValidRequestUri with IP URL with https prefix' , () {
91
+ String url1 = "https://8.8.8.8:8080" ;
92
+ Uri uri1Expected = Uri (scheme: 'https' , host: '8.8.8.8' , port: 8080 );
93
+ expect (getValidRequestUri (url1, []), (uri1Expected, null ));
94
+ });
95
+
65
96
test ('Testing getValidRequestUri for normal values' , () {
66
97
String url1 = "https://api.apidash.dev/country/data" ;
67
98
const kvRow1 = NameValueModel (name: "code" , value: "US" );
0 commit comments