Skip to content

Commit

Permalink
Improved checking with different data
Browse files Browse the repository at this point in the history
  • Loading branch information
Nigel Horne committed Oct 1, 2020
1 parent 5e83010 commit 7c016d7
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions t/maxmind.t
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use warnings;
use strict;
use Test::Most tests => 97;
use Test::Most tests => 98;
use Test::Carp;
use Test::Deep;
use Test::Number::Delta;
Expand Down Expand Up @@ -174,7 +174,7 @@ MAXMIND: {

@locations = $geo_coder->geocode('Sheppey, Kent, England');
ok(scalar(@locations) > 1);
diag(scalar(@locations));
# diag(scalar(@locations));

$location = $geo_coder->geocode('Nebraska, USA');
ok(defined($location));
Expand All @@ -185,7 +185,22 @@ MAXMIND: {
# Check a second lookup still works
check($geo_coder, 'Westoe, South Tyneside, England', 54.98, -1.42);

like($geo_coder->reverse_geocode(latlng => '51.50,-0.13'), qr/London/i, 'test reverse');
# like($geo_coder->reverse_geocode(latlng => '51.50,-0.13'), qr/London/i, 'test reverse');
@locations = $geo_coder->reverse_geocode(latlng => '51.50,-0.13');
ok(scalar(@locations) > 1);
my $found = 0;
foreach my $location(@locations) {
if($location =~ /London,/i) {
$found = 1;
last;
}
}

if(!$found) {
diag("Failed reverse lookup $location");
diag(Data::Dumper->new([\@locations])->Dump());
}
ok($found);

does_croak(sub {
$location = $geo_coder->geocode();
Expand All @@ -206,7 +221,7 @@ MAXMIND: {
}
} else {
diag('Author tests not required for installation');
skip('Author tests not required for installation', 96);
skip('Author tests not required for installation', 97);
}
}
}
Expand Down

0 comments on commit 7c016d7

Please sign in to comment.