diff options
Diffstat (limited to 't')
-rw-r--r-- | t/app/controller/around.t | 21 | ||||
-rw-r--r-- | t/app/engine.t | 9 |
2 files changed, 25 insertions, 5 deletions
diff --git a/t/app/controller/around.t b/t/app/controller/around.t index d1254edb7..618998513 100644 --- a/t/app/controller/around.t +++ b/t/app/controller/around.t @@ -137,25 +137,28 @@ subtest 'check non public reports are not displayed on around page' => sub { }; -subtest 'check category and status filtering works on /around?ajax' => sub { +subtest 'check category and status filtering works on /around' => sub { + my $body = $mech->create_body_ok(2237, "Oxfordshire"); + my $categories = [ 'Pothole', 'Vegetation', 'Flytipping' ]; my $params = { - postcode => 'OX1 1ND', - latitude => 51.7435918829363, - longitude => -1.23201966270446, + postcode => 'OX20 1SZ', + latitude => 51.754926, + longitude => -1.256179, }; my $bbox = ($params->{longitude} - 0.01) . ',' . ($params->{latitude} - 0.01) . ',' . ($params->{longitude} + 0.01) . ',' . ($params->{latitude} + 0.01); # Create one open and one fixed report in each category foreach my $category ( @$categories ) { + $mech->create_contact_ok( category => $category, body_id => $body->id, email => "$category\@example.org" ); foreach my $state ( 'confirmed', 'fixed' ) { my %report_params = ( %$params, category => $category, state => $state, ); - $mech->create_problems_for_body( 1, 2237, 'Around page', \%report_params ); + $mech->create_problems_for_body( 1, $body->id, 'Around page', \%report_params ); } } @@ -163,6 +166,14 @@ subtest 'check category and status filtering works on /around?ajax' => sub { my $pins = $json->{pins}; is scalar @$pins, 6, 'correct number of reports when no filters'; + # Regression test for filter_category in /around URL + FixMyStreet::override_config { + MAPIT_URL => 'http://mapit.uk/', + }, sub { + $mech->get_ok( '/around?filter_category=Pothole&bbox=' . $bbox ); + $mech->content_contains('<option value="Pothole" selected>'); + }; + $json = $mech->get_ok_json( '/around?ajax=1&filter_category=Pothole&bbox=' . $bbox ); $pins = $json->{pins}; is scalar @$pins, 2, 'correct number of Pothole reports'; diff --git a/t/app/engine.t b/t/app/engine.t new file mode 100644 index 000000000..d99c5e087 --- /dev/null +++ b/t/app/engine.t @@ -0,0 +1,9 @@ +use FixMyStreet::Test; + +use Catalyst::Test 'FixMyStreet::App'; + +my $res = request("/?_override_foo=bar"); + +like $res->headers->header('Set-Cookie'), qr/SameSite=Lax/; + +done_testing; |