From 7c016d7c30b9d22aec1eaabad7c0d604b609e4f6 Mon Sep 17 00:00:00 2001 From: Nigel Horne Date: Thu, 1 Oct 2020 08:49:48 -0400 Subject: [PATCH] Improved checking with different data --- t/maxmind.t | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/t/maxmind.t b/t/maxmind.t index b28529e..286c0a2 100644 --- a/t/maxmind.t +++ b/t/maxmind.t @@ -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; @@ -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)); @@ -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(); @@ -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); } } }