File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 1+ import 'package:flutter_test/flutter_test.dart' ;
2+ import 'package:http_interceptor/utils.dart' ;
3+
4+ main () {
5+ group ("addParametersToUrl" , () {
6+ test ("Adds parameters to a URL string without parameters" , () {
7+ // Arrange
8+ String url = "https://www.google.com/helloworld" ;
9+ Map <String , String > parameters = {"foo" : "bar" , "num" : "0" };
10+
11+ // Act
12+ String parameterUrl = addParametersToUrl (url, parameters);
13+
14+ // Assert
15+ expect (parameterUrl,
16+ equals ("https://www.google.com/helloworld?foo=bar&num=0" ));
17+ });
18+ test ("Adds parameters to a URL string with parameters" , () {
19+ // Arrange
20+ String url = "https://www.google.com/helloworld?foo=bar&num=0" ;
21+ Map <String , String > parameters = {"extra" : "1" , "extra2" : "anotherone" };
22+
23+ // Act
24+ String parameterUrl = addParametersToUrl (url, parameters);
25+
26+ // Assert
27+ expect (
28+ parameterUrl,
29+ equals (
30+ "https://www.google.com/helloworld?foo=bar&num=0&extra=1&extra2=anotherone" ));
31+ });
32+ });
33+ }
You can’t perform that action at this time.
0 commit comments