aboutsummaryrefslogtreecommitdiffstats
path: root/t/map/tests.t
blob: 728aa5125f1c3246f9f5f5df7c33e4dbe4089e6b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use FixMyStreet::Map;
use Test::More;

my $requires = {
    'BathNES' => 'bathnes/assets.js',
    'Bing' => 'map-bing-ol.js',
    'Bristol' => 'bristol/assets.js',
    'Bromley' => 'bromley/assets.js',
    'Buckinghamshire' => 'buckinghamshire/assets.js',
    'Lincolnshire' => 'lincolnshire/assets.js',
    'FMS' => 'map-fms.js',
    'Google' => 'map-google.js',
    'GoogleOL' => 'map-google-ol.js',
    'OSM' => 'OpenStreetMap.js',
    'CycleMap' => 'OpenStreetMap.js',
    'MapQuest' => 'OpenStreetMap.js',
    'StreetView' => 'map-streetview.js',
    'TonerLite' => 'map-toner-lite.js',
    'Zurich' => 'map-wmts-zurich.js',
};

foreach (FixMyStreet::Map->maps) {
    next if /WMTSBase/; # Only its subclasses have JS
    my $js = $_->map_javascript;
    my $test_file = $js->[-1];
    s/.*:://;
    isnt $requires->{$_}, undef, "$_ requires present";
    like $test_file, qr/$requires->{$_}/, "$_ JS okay";
}

done_testing();