aboutsummaryrefslogtreecommitdiffstats
path: root/t/Page.t
diff options
context:
space:
mode:
Diffstat (limited to 't/Page.t')
-rwxr-xr-xt/Page.t34
1 files changed, 22 insertions, 12 deletions
diff --git a/t/Page.t b/t/Page.t
index d4ccc9f3d..a1ae7f3aa 100755
--- a/t/Page.t
+++ b/t/Page.t
@@ -38,17 +38,24 @@ sub set_lang($) {
sub test_geocode_string() {
my %params = ();
- my $q = new MockQuery('nosite', \%params);
-
- # geocode a straightforward string, expect success
- my ($easting, $northing, $error) = FixMyStreet::Geocode::string('Buckingham Palace', $q);
- ok($easting == 529068, 'example easting generated') or diag("Got $easting");
- ok($northing == 179684, 'example northing generated') or diag("Got $northing");
- ok(! defined($error), 'should not generate error for simple example') or diag("Got $error");
- # expect a failure message for Northern Ireland
- ($easting, $northing, $error) = FixMyStreet::Geocode::string('Falls Road, Belfast', $q);
- ok($error eq "We do not cover Northern Ireland, I'm afraid, as our licence doesn't include any maps for the region.", 'error message produced for NI location') or diag("Got $error");
+ my $q = new MockQuery( 'nosite', \%params );
+
+ # geocode a straightforward string, expect success
+ my ( $latitude, $longitude, $error ) =
+ FixMyStreet::Geocode::string( 'Buckingham Palace', $q );
+ is( $latitude, 51.5013639, 'example easting generated' );
+ is( $longitude, -0.1418898, 'example northing generated' );
+ is( $error, undef, 'should not generate error for simple example' );
+ # expect a failure message for Northern Ireland
+ ( $latitude, $longitude, $error ) =
+ FixMyStreet::Geocode::string( 'Falls Road, Belfast', $q );
+ is(
+ $error,
+ "We do not cover Northern Ireland, I'm afraid, as our licence doesn't "
+ . "include any maps for the region.",
+ 'error message produced for NI location'
+ );
}
sub test_header() {
@@ -64,9 +71,12 @@ sub test_header() {
# Test that template passed is rendered
$params{'template'} = 'test';
- $html = Page::template_header('test', $q, '/../t/templates/' . $q->{site} . '/', title=>'My test title', lang=>'en-gb');
+ $html = Page::template_include('test-header', $q,
+ '/../t/templates/' . $q->{site} . '/',
+ title => 'My test title', lang => 'en-gb'
+ );
+
like ($html, qr/My test header template/, 'named template rendered ok');
-
return 1;
}