summaryrefslogtreecommitdiff
path: root/t/21-vrr-ambig.t
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2024-09-22 13:19:14 +0200
committerBirte Kristina Friesel <derf@finalrewind.org>2024-09-22 13:19:14 +0200
commitc438b3c4e210a4480652f297f1bf9510cdf44244 (patch)
tree2b2445ecba473799c3ebed1f7b8b1210084f29bc /t/21-vrr-ambig.t
parentb8bdca3c045787ad546234fff0cf5801dbe1cd92 (diff)
Switch from XML to JSON API flavour
Diffstat (limited to 't/21-vrr-ambig.t')
-rw-r--r--t/21-vrr-ambig.t35
1 files changed, 22 insertions, 13 deletions
diff --git a/t/21-vrr-ambig.t b/t/21-vrr-ambig.t
index e4783f5..a201d52 100644
--- a/t/21-vrr-ambig.t
+++ b/t/21-vrr-ambig.t
@@ -5,27 +5,36 @@ use 5.010;
use utf8;
use File::Slurp qw(slurp);
-use Test::More tests => 10;
+use JSON;
+use Test::More tests => 9;
BEGIN {
use_ok('Travel::Status::DE::VRR');
}
require_ok('Travel::Status::DE::VRR');
-my $xml = slurp('t/in/essen_alfredusbad_ambiguous.xml');
+my $json
+ = JSON->new->utf8->decode( scalar slurp('t/in/essen_alfred_ambiguous.json') );
-my $status = Travel::Status::DE::VRR->new_from_xml(xml => $xml);
+my $status = Travel::Status::DE::VRR->new( from_json => $json );
-isa_ok($status, 'Travel::Status::DE::VRR');
-can_ok($status, qw(errstr results));
+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], ['Alfredusbad', 'Am Alfredusbad'], 'name candidates ok');
-
-is_deeply([$status->lines], [], 'no lines');
-is_deeply([$status->results], [], 'no results');
-is_deeply([$status->identified_data], [qw[Essen Alfredusbad]], 'identified data');
+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' );