From 74f7db8938d62feed1e0c46e7914e5fb25244661 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sat, 10 Oct 2015 15:04:29 +0200 Subject: update tests --- t/22-marudor.t | 40 ++++++++++++++++++---------------------- t/31-clean-ris.t | 24 ------------------------ 2 files changed, 18 insertions(+), 46 deletions(-) delete mode 100644 t/31-clean-ris.t (limited to 't') diff --git a/t/22-marudor.t b/t/22-marudor.t index e11bb88..7038ca6 100644 --- a/t/22-marudor.t +++ b/t/22-marudor.t @@ -14,35 +14,31 @@ my $t = Test::Mojo->new; # be because of IRIS problems or unanticipated schedule changes. # TODO: Support mock XML from hard disk. -$t->get_ok('/EDUV?mode=marudor_v1&backend=iris') +$t->get_ok('/EDUV?mode=marudor&version=1') ->status_is(200) - ->json_has('/api_version', 'has api_version') - ->json_has('/version', 'has version') - ->json_has('/preformatted', 'has preformatted') - ->json_has('/preformatted/0', 'has a departure') - ->json_has('/preformatted/0/additional_stops', '.additional_stops') - ->json_has('/preformatted/0/canceled_stops', '.canceled_stops') - ->json_has('/preformatted/0/delay', '.delay') - ->json_like('/preformatted/0/destination', + ->json_has('/departures', 'has departures') + ->json_has('/departures/0', 'has a departure') + ->json_has('/departures/0/route', '.route') + ->json_has('/departures/0/delay', '.delay') + ->json_like('/departures/0/destination', qr{ ^ (Dortmund|Bochum|Essen|D.sseldorf|Solingen) \s Hbf $}x, '.destination') - ->json_has('/preformatted/0/info', '.info') - ->json_like('/preformatted/0/is_cancelled', qr{ ^ 0 | 1 $ }x, '.is_cancelled') - ->json_has('/preformatted/0/messages', '.messages') - ->json_has('/preformatted/0/messages/delay', '.messages.delay') - ->json_has('/preformatted/0/messages/qos', '.messages.qos') - ->json_like('/preformatted/0/time', qr{ ^ \d \d? : \d\d $ }x, '.time') - ->json_is('/preformatted/0/train', 'S 1', '.train') - ->json_like('/preformatted/0/platform', qr{ ^ 1 | 2 $}x, '.platform') - ->json_like('/preformatted/0/scheduled_route/0', + ->json_like('/departures/0/isCancelled', qr{ ^ 0 | 1 $ }x, '.is_cancelled') + ->json_has('/departures/0/messages', '.messages') + ->json_has('/departures/0/messages/delay', '.messages.delay') + ->json_has('/departures/0/messages/qos', '.messages.qos') + ->json_like('/departures/0/time', qr{ ^ \d \d? : \d\d $ }x, '.time') + ->json_is('/departures/0/train', 'S 1', '.train') + ->json_like('/departures/0/platform', qr{ ^ 1 | 2 $}x, '.platform') + ->json_like('/departures/0/route/0/name', qr{ ^ (Dortmund|Bochum|Essen|D.sseldorf|Solingen) \s Hbf $}x, - '.scheduled_route[0]') - ->json_like('/preformatted/0/via/0', + '.route[0]') + ->json_like('/departures/0/via/0', qr{ ^ Dortmund-Dorstfeld \s S.d | Dortmund-Oespel $}x, - '.scheduled_route[0]') + '.via[0]') ; -$t->get_ok('/EDUV?mode=marudor_v1&backend=iris&callback=my_callback') +$t->get_ok('/EDUV?mode=marudor&version=1&callback=my_callback') ->status_is(200) ->content_like(qr{ ^ my_callback \( }x, 'json callback works'); # ) <- just here to fix bracket grouping in vim diff --git a/t/31-clean-ris.t b/t/31-clean-ris.t deleted file mode 100644 index 424bba7..0000000 --- a/t/31-clean-ris.t +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env perl -use strict; -use warnings; -use 5.014; -use Test::More; -use Test::Mojo; - -use FindBin; -require "$FindBin::Bin/../index.pl"; - -my $t = Test::Mojo->new; - -# Note: These tests depends on RIS live data. If it fails, it -might- also -# be because of RIS problems or unanticipated schedule changes. -# TODO: Support mock XML from hard disk. - -$t->get_ok('/Dortmund Universitat?backend=ris') - ->status_is(200) - ->content_like(qr{S 1}, 'train name') - ->content_like(qr{Dortmund Hbf}, 'dest') - ->content_like(qr{Dortmund-Oespel}, 'via') - ; - -done_testing(); -- cgit v1.2.3