diff options
Diffstat (limited to 't/app/controller')
-rw-r--r-- | t/app/controller/around.t | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/t/app/controller/around.t b/t/app/controller/around.t index 29752ab02..3f5d31c02 100644 --- a/t/app/controller/around.t +++ b/t/app/controller/around.t @@ -309,6 +309,37 @@ subtest 'check category, status and extra filtering works on /around' => sub { is scalar @$pins, 1, 'correct number of external_body reports'; }; +subtest 'check categories with same name are only shown once in filters' => sub { + my $params = { + 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); + + my $district = $mech->create_body_ok(2421, "Oxford City"); + # Identically-named categories should be combined even if their extra metadata is different + my $contact2 = $mech->create_contact_ok( category => "Pothole", body_id => $district->id, email => 'pothole@district-example.org' ); + $contact2->set_extra_metadata(some_extra_field => "dummy"); + $contact2->update; + # And categories with the same display name should be combined too + my $contact3 = $mech->create_contact_ok( category => "Pothole (alternative)", body_id => $district->id, email => 'pothole-alternative@district-example.org' ); + $contact3->set_extra_metadata(display_name => "Pothole"); + $contact3->update; + + FixMyStreet::override_config { + ALLOWED_COBRANDS => 'fixmystreet', + MAPIT_URL => 'http://mapit.uk/', + COBRAND_FEATURES => { category_groups => { fixmystreet => 1 } }, + }, sub { + $mech->get_ok( '/around?bbox=' . $bbox ); + $mech->content_contains('<option value="Pothole">'); + $mech->content_unlike(qr{Pothole</option>.*<option value="Pothole">\s*Pothole</option>}s, "Pothole category only appears once"); + $mech->content_lacks('<option value="Pothole (alternative)">'); + }; +}; + subtest 'check old problems not shown by default on around page' => sub { my $params = { postcode => 'OX20 1SZ', |