diff options
Diffstat (limited to 't/cobrand/bexley.t')
-rw-r--r-- | t/cobrand/bexley.t | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/t/cobrand/bexley.t b/t/cobrand/bexley.t index b929cbce1..3937129d3 100644 --- a/t/cobrand/bexley.t +++ b/t/cobrand/bexley.t @@ -2,8 +2,10 @@ use CGI::Simple; use Test::MockModule; use FixMyStreet::TestMech; use FixMyStreet::Script::Reports; +use Catalyst::Test 'FixMyStreet::App'; use_ok 'FixMyStreet::Cobrand::Bexley'; +use_ok 'FixMyStreet::Geocode::Bexley'; use_ok 'FixMyStreet::Map::Bexley'; my $ukc = Test::MockModule->new('FixMyStreet::Cobrand::UKCouncils'); @@ -166,4 +168,38 @@ subtest 'correct map tiles used' => sub { } }; +my $geo = Test::MockModule->new('FixMyStreet::Geocode'); +$geo->mock('cache', sub { + my $typ = shift; + return [] if $typ eq 'osm'; + return { + features => [ + { + properties => { ADDRESS => 'BRAMPTON ROAD', TOWN => 'BEXLEY' }, + geometry => { type => 'LineString', coordinates => [ [ 1, 2 ], [ 3, 4] ] }, + }, + { + properties => { ADDRESS => 'FOOTPATH TO BRAMPTON ROAD', TOWN => 'BEXLEY' }, + geometry => { type => 'MultiLineString', coordinates => [ [ [ 1, 2 ], [ 3, 4 ] ], [ [ 5, 6 ], [ 7, 8 ] ] ] }, + }, + ], + } if $typ eq 'bexley'; +}); + +subtest 'geocoder' => sub { + my $c = ctx_request('/'); + my $results = FixMyStreet::Geocode::Bexley->string("Brampton Road", $c); + is_deeply $results, { error => [ + { + 'latitude' => '49.766844', + 'longitude' => '-7.557122', + 'address' => 'Brampton Road, Bexley' + }, { + 'address' => 'Footpath to Brampton Road, Bexley', + 'longitude' => '-7.557097', + 'latitude' => '49.766863' + } + ] }; +}; + done_testing(); |