Skip to content

Commit

Permalink
Merge pull request #7 from sumanrajpathak/tests
Browse files Browse the repository at this point in the history
✅ Tests Added
  • Loading branch information
sumanrajpathak authored Apr 8, 2024
2 parents 4dabd59 + c6a209e commit adfce01
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/src/ip_address_base_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,20 @@ void main() {
expect(countryCode3, isNotNull);
expect(countryCode3, geoIpJson["country_code3"]);
});
test("getCountryCodeFor", () async {
when(() => repository.getCountryCodeFor(geoIpJson["ip"]))
.thenAnswer((_) async => geoIpJson["country_code"]);
String countryCode = await repository.getCountryCodeFor(geoIpJson["ip"]);
expect(countryCode, isNotNull);
expect(countryCode, geoIpJson["country_code"]);
});
test("getCountryFor", () async {
when(() => repository.getCountryFor(geoIpJson["ip"]))
.thenAnswer((_) async => geoIpJson["country"]);
String country = await repository.getCountryFor(geoIpJson["ip"]);
expect(country, isNotNull);
expect(country, geoIpJson["country"]);
});

test("getSeeIp", () async {
when(() => repository.getSeeIp("ip")).thenAnswer((_) async => testIP);
Expand Down

0 comments on commit adfce01

Please sign in to comment.