diff options
author | M Somerville <matthew-github@dracos.co.uk> | 2020-05-29 11:09:36 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2020-06-04 21:08:36 +0100 |
commit | abc63a85b47bbc6b9e81c8256a226864ac7fe0ce (patch) | |
tree | e3eb1fc9e6f50bc7cc235de626202da084449042 /t/app/controller | |
parent | ce5588038dfafb2db53c7de7e0d34e8c59bed8ba (diff) |
Add Open Location Codes support to search box.
Diffstat (limited to 't/app/controller')
-rw-r--r-- | t/app/controller/around.t | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/t/app/controller/around.t b/t/app/controller/around.t index be8b0df9e..784801517 100644 --- a/t/app/controller/around.t +++ b/t/app/controller/around.t @@ -9,6 +9,7 @@ use constant MIN_ZOOM_LEVEL => 88; package main; use Test::MockModule; +use t::Mock::Nominatim; use FixMyStreet::TestMech; my $mech = FixMyStreet::TestMech->new; @@ -89,6 +90,30 @@ foreach my $test ( }; } +subtest "check lat/lng for full plus code" => sub { + $mech->get_ok('/'); + $mech->submit_form_ok( { with_fields => { pc => "9C7RXR26+R5" } } ); + is_deeply $mech->page_errors, [], "no errors for plus code"; + is_deeply $mech->extract_location, { + pc => "9C7RXR26+R5", + latitude => 55.952063, + longitude => -3.189562, + }, + "got expected location for full plus code"; +}; + +subtest "check lat/lng for short plus code" => sub { + $mech->get_ok('/'); + $mech->submit_form_ok( { with_fields => { pc => "XR26+R5 Edinburgh" } } ); + is_deeply $mech->page_errors, [], "no errors for plus code"; + is_deeply $mech->extract_location, { + pc => "XR26+R5 Edinburgh", + latitude => 55.952063, + longitude => -3.189562, + }, + "got expected location for short plus code"; +}; + my $body_edin_id = $mech->create_body_ok(2651, 'City of Edinburgh Council')->id; my $body_west_id = $mech->create_body_ok(2504, 'Westminster City Council')->id; |