diff options
author | Matthew Somerville <matthew@mysociety.org> | 2020-06-23 14:32:42 +0100 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2020-06-25 09:35:02 +0100 |
commit | d1c38a2bdbe5891fa63bde40e398e3cc33881566 (patch) | |
tree | a3be291dccfde91d912e3ff5b4e3e3635e9aeb92 /t/geocode/bing.t | |
parent | 2b462f20d2479649c14efead2680a49543ca32d0 (diff) |
Improve Bing geocoder results.
Add a couple of parameters to hopefully improve results, and make
sure the returned locality is included in the summary address.
Diffstat (limited to 't/geocode/bing.t')
-rw-r--r-- | t/geocode/bing.t | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/t/geocode/bing.t b/t/geocode/bing.t new file mode 100644 index 000000000..32cffaa4e --- /dev/null +++ b/t/geocode/bing.t @@ -0,0 +1,24 @@ +use FixMyStreet::Test; +use FixMyStreet::Geocode::Bing; +use Catalyst::Test 'FixMyStreet::App'; +use t::Mock::Bing; + +my $c = ctx_request('/'); + +FixMyStreet::override_config { + GEOCODING_DISAMBIGUATION => { bing_culture => 'en-GB' } +}, sub { + my $r = FixMyStreet::Geocode::Bing->string('a result', $c); + ok $r->{latitude}; + ok $r->{longitude}; +}; + +FixMyStreet::override_config { + GEOCODING_DISAMBIGUATION => { bing_country => 'United Kingdom' } +}, sub { + my $r = FixMyStreet::Geocode::Bing->string('two results', $c); + is scalar @{$r->{error}}, 2; + is $r->{error}[1]{address}, 'Constitution Hill again, London'; +}; + +done_testing; |