aboutsummaryrefslogtreecommitdiffstats
path: root/t/geocode/bing.t
diff options
context:
space:
mode:
Diffstat (limited to 't/geocode/bing.t')
-rw-r--r--t/geocode/bing.t30
1 files changed, 30 insertions, 0 deletions
diff --git a/t/geocode/bing.t b/t/geocode/bing.t
new file mode 100644
index 000000000..156f983e1
--- /dev/null
+++ b/t/geocode/bing.t
@@ -0,0 +1,30 @@
+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';
+};
+
+my $r = FixMyStreet::Geocode::Bing->string('two results andalow', $c);
+is scalar @{$r->{error}}, 2;
+
+$r = FixMyStreet::Geocode::Bing->string('two results onlylow', $c);
+is scalar @{$r->{error}}, 3;
+
+done_testing;