summaryrefslogtreecommitdiff
path: root/t/01-geocode.t
blob: a53e1453f58f60c4b14ffe7f714420ac96d17f2b (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
#!perl

use Test::More tests => 1;
use Geo::TomTom::Geocoding;

SKIP: {
  my $key = $ENV{TOMTOM_API_KEY};
  skip("TOMTOM_API_KEY not set", 1) unless $key;

  my $test_loc = [
    key => $key,
    ST  => 55,
    T   => 'Music Concourse Drive',
    L   => 'San Francisco',
    AA  => 'CA',
    CC  => 'USA',
  ];
  my $response = Geo::TomTom::Geocoding->query($test_loc);
  my ($first_match) = $response->locations;
  note "Test results:\n".explain $first_match;
  ok( $first_match->{postcode} =~ /^94118/ );

}