summaryrefslogtreecommitdiff
path: root/t/21-vrr-ambig.t
blob: a201d5210addbb667e3ba25b1e8856c36525aab3 (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
32
33
34
35
36
37
38
39
40
#!/usr/bin/env perl
use strict;
use warnings;
use 5.010;
use utf8;

use File::Slurp qw(slurp);
use JSON;
use Test::More tests => 9;

BEGIN {
	use_ok('Travel::Status::DE::VRR');
}
require_ok('Travel::Status::DE::VRR');

my $json
  = JSON->new->utf8->decode( scalar slurp('t/in/essen_alfred_ambiguous.json') );

my $status = Travel::Status::DE::VRR->new( from_json => $json );

isa_ok( $status, 'Travel::Status::DE::VRR' );
can_ok( $status, qw(errstr results) );

$status->check_for_ambiguous();

is( $status->errstr, 'ambiguous name parameter', 'errstr ok' );

is_deeply( [ $status->place_candidates ], [], 'place candidates ok' );
is_deeply(
	[ $status->name_candidates ],
	[
		'Essen, Alfred-Krupp-Schule',
		'Essen, Alfredbrücke',
		'Essen, Alfredusbad'
	],
	'name candidates ok'
);

is_deeply( [ $status->lines ],   [], 'no lines' );
is_deeply( [ $status->results ], [], 'no results' );