Skip to content
Snippets Groups Projects
Commit 54943f4f authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

DeutscheBahn/Result: route_interesting adjustment, add tests for it

parent 91a31f67
No related branches found
No related tags found
No related merge requests found
......@@ -79,6 +79,10 @@ sub route_interesting {
}
$last_stop = pop(@via);
if ( @via_main and $via_main[-1] eq $last_stop ) {
pop(@via_main);
}
if ( @via_main and @via and $via[0] eq $via_main[0] ) {
shift(@via_main);
}
......
......@@ -4,7 +4,7 @@ use warnings;
use 5.010;
use File::Slurp qw(slurp);
use Test::More tests => 90;
use Test::More tests => 93;
BEGIN {
use_ok('Travel::Status::DE::DeutscheBahn');
......@@ -44,3 +44,15 @@ is_deeply([$departures[8]->route],
['Essen-Borbeck', 'Bottrop Hbf', 'Gladbeck West', 'Gladbeck-Zweckel',
'Feldhausen', 'Dorsten', 'Hervest-Dorsten', 'Deuten', 'Rhade',
'Marbeck-Heiden', 'Borken(Westf)'], '9th result: route ok');
is_deeply([$departures[5]->route_interesting(3)],
['Essen-Steele', 'Essen-Steele Ost', 'Bochum'],
'6th result: route_interesting(3) ok');
is_deeply([$departures[7]->route_interesting(3)],
['Wattenscheid', 'Bochum', 'Dortmund'],
'8th result: route_interesting(3) ok');
is_deeply([$departures[10]->route_interesting(5)],
[qw[Wattenscheid Bochum Witten Hagen]],
'11th result: route_interesting(5) ok');
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment