Skip to content

Commit de3aed0

Browse files
committed
Changelog:
- Renamed utlis_test to utils_test. - Removed author section no longer needed.
1 parent eb33c82 commit de3aed0

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

test/utils_test.dart

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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+
}

0 commit comments

Comments
 (0)