aboutsummaryrefslogtreecommitdiffstats
path: root/t/app
diff options
context:
space:
mode:
Diffstat (limited to 't/app')
-rw-r--r--t/app/controller/around.t31
-rw-r--r--t/app/controller/index.t7
2 files changed, 34 insertions, 4 deletions
diff --git a/t/app/controller/around.t b/t/app/controller/around.t
new file mode 100644
index 000000000..021cf8f7d
--- /dev/null
+++ b/t/app/controller/around.t
@@ -0,0 +1,31 @@
+use strict;
+use warnings;
+use Test::More;
+
+use FixMyStreet::TestMech;
+my $mech = FixMyStreet::TestMech->new;
+
+subtest "check that if no query we get sent back to the homepage" => sub {
+ $mech->get_ok('/around');
+ is $mech->uri->path, '/', "sent back to '/'";
+};
+
+# x,y requests were generated by the old map code. We keep the behavior for
+# historic links
+subtest "redirect x,y requests to lat/lon (301 - permanent)" => sub {
+
+ $mech->get_ok('/around?x=3281&y=1113');
+
+ # did we redirect to lat,lon?
+ is $mech->uri->path, '/around', "still on /around";
+ is_deeply { $mech->uri->query_form },
+ { lat => 51.4998246332569, lon => -0.140137309739907, },
+ "lat,lon correctly set";
+
+ # was it a 301?
+ is $mech->res->code, 200, "got 200 for final destination";
+ is $mech->res->previous->code, 301, "got 301 for redirect";
+
+};
+
+done_testing();
diff --git a/t/app/controller/index.t b/t/app/controller/index.t
index 91f01c943..11c59d289 100644
--- a/t/app/controller/index.t
+++ b/t/app/controller/index.t
@@ -21,10 +21,9 @@ subtest "check that the form goes to /around" => sub {
};
subtest "check that requests with pc, x,y or lat,lon go to /around" => sub {
- foreach my $test (
- { pc => 'SW1A 1AA', },
- { x => 3281, y => 1113, },
- { lat => 51.50100, lon => -0.14158, },
+ foreach my $test ( #
+ { pc => 'SW1A 1AA' }, #
+ { lat => 51.50100, lon => -0.14158 },
)
{
my $uri = URI->new('http://localhost/');