Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Test expanded search results.
  • Loading branch information
oalders committed May 12, 2017
1 parent 5448b8e commit 78597ee
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions t/model/search.t
Expand Up @@ -21,8 +21,28 @@ ok( $search->_not_rogue, '_not_rogue' );
}

{
my $results = $search->search_web('Foo');
is( scalar @{ $results->{results}->[0] }, 2, 'got results' );
my $collapsed_search = $search->search_web('Foo');
is( scalar @{ $collapsed_search->{results}->[0] },
2, 'got results for collapsed search' );

ok(
${ $collapsed_search->{collapsed} },
'results are flagged as collapsed'
);

my $from = 0;
my $page_size = 20;
my $collapsed = 0;

my $expanded
= $search->search_web( 'Foo', $from, $page_size, $collapsed );

ok( !${ $expanded->{collapsed} }, 'results are flagged as expanded' );

is( $expanded->{results}->[0]->[0]->{path},
'lib/Pod/Pm.pm', 'first expanded result is expected' );
is( $expanded->{results}->[1]->[0]->{path},
'lib/Pod/Pm/NoPod.pod', 'second expanded result is expected' );
}

{
Expand Down

0 comments on commit 78597ee

Please sign in to comment.