Skip to content

Commit 02cf8bd

Browse files
committed
re-enable all tests
1 parent df39d20 commit 02cf8bd

File tree

1 file changed

+75
-73
lines changed

1 file changed

+75
-73
lines changed

t/model/search.t

Lines changed: 75 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ use MetaCPAN::TestServer ();
66
use Test::More;
77
use Test::Deep;
88

9-
plan skip_all => "Travis ES bad" if $ENV{TRAVIS};
9+
plan skip_all =>
10+
"Travis ES bad, see https://travis-ci.org/metacpan/metacpan-api/jobs/301092129"
11+
if $ENV{TRAVIS};
1012

1113
# Just use this to get an es object.
1214
my $server = MetaCPAN::TestServer->new;
@@ -18,89 +20,89 @@ my $search = MetaCPAN::Model::Search->new(
1820
ok( $search, 'search' );
1921
ok( $search->_not_rogue, '_not_rogue' );
2022

21-
# {
22-
# my $results = $search->search_web('Fooxxxx');
23-
# cmp_deeply( $results, {}, 'no results on fake module' );
24-
# }
23+
{
24+
my $results = $search->search_web('Fooxxxx');
25+
cmp_deeply( $results, {}, 'no results on fake module' );
26+
}
2527

26-
# {
27-
# my $collapsed_search = $search->search_web('Foo');
28-
# is( scalar @{ $collapsed_search->{results}->[0] },
29-
# 2, 'got results for collapsed search' );
28+
{
29+
my $collapsed_search = $search->search_web('Foo');
30+
is( scalar @{ $collapsed_search->{results}->[0] },
31+
2, 'got results for collapsed search' );
3032

31-
# ok(
32-
# ${ $collapsed_search->{collapsed} },
33-
# 'results are flagged as collapsed'
34-
# );
33+
ok(
34+
${ $collapsed_search->{collapsed} },
35+
'results are flagged as collapsed'
36+
);
3537

36-
# my $from = 0;
37-
# my $page_size = 20;
38-
# my $collapsed = 0;
38+
my $from = 0;
39+
my $page_size = 20;
40+
my $collapsed = 0;
3941

40-
# my $expanded
41-
# = $search->search_web( 'Foo', $from, $page_size, $collapsed );
42+
my $expanded
43+
= $search->search_web( 'Foo', $from, $page_size, $collapsed );
4244

43-
# ok( !${ $expanded->{collapsed} }, 'results are flagged as expanded' );
45+
ok( !${ $expanded->{collapsed} }, 'results are flagged as expanded' );
4446

45-
# is( $expanded->{results}->[0]->[0]->{path},
46-
# 'lib/Pod/Pm.pm', 'first expanded result is expected' );
47-
# is( $expanded->{results}->[1]->[0]->{path},
48-
# 'lib/Pod/Pm/NoPod.pod', 'second expanded result is expected' );
49-
# }
47+
is( $expanded->{results}->[0]->[0]->{path},
48+
'lib/Pod/Pm.pm', 'first expanded result is expected' );
49+
is( $expanded->{results}->[1]->[0]->{path},
50+
'lib/Pod/Pm/NoPod.pod', 'second expanded result is expected' );
51+
}
5052

5153
{
5254
my $results = $search->search_web('author:Mo');
5355
is( @{ $results->{results} }, 5, '5 results on author search' );
5456
}
5557

56-
# {
57-
# my $long_form = $search->search_web('distribution:Pod-Pm');
58-
# my $short_form = $search->search_web('dist:Pod-Pm');
59-
60-
# cmp_deeply(
61-
# $long_form->{results},
62-
# $short_form->{results},
63-
# 'dist == distribution search'
64-
# );
65-
# }
66-
67-
# {
68-
# my $module = 'Binary::Data::WithPod';
69-
# my $results = $search->search_web($module);
70-
# is(
71-
# $results->{results}->[0]->[0]->{description},
72-
# 'razzberry pudding',
73-
# 'description included in results'
74-
# );
75-
# }
76-
77-
# {
78-
# my $id = 'JatCtNR2RGjcBIs1Y5C_zTzNcXU';
79-
# my $results = $search->search_descriptions($id);
80-
# cmp_deeply( $results->{results}, { $id => 'TBD' },
81-
# 'search_descriptions' );
82-
# }
83-
84-
# # favorites are also tested in t/server/controller/user/favorite.t
85-
# cmp_deeply( $search->search_favorites, {},
86-
# 'empty hashref when no distributions' );
87-
88-
# cmp_deeply(
89-
# $search->search_favorites('Pod-Pm'),
90-
# {
91-
# favorites => {},
92-
# took => ignore(),
93-
# },
94-
# 'no favorites found'
95-
# );
96-
97-
# cmp_deeply(
98-
# $search->search_descriptions,
99-
# {
100-
# descriptions => {},
101-
# took => ignore(),
102-
# },
103-
# 'empty hashref when no ids for descriptions'
104-
# );
58+
{
59+
my $long_form = $search->search_web('distribution:Pod-Pm');
60+
my $short_form = $search->search_web('dist:Pod-Pm');
61+
62+
cmp_deeply(
63+
$long_form->{results},
64+
$short_form->{results},
65+
'dist == distribution search'
66+
);
67+
}
68+
69+
{
70+
my $module = 'Binary::Data::WithPod';
71+
my $results = $search->search_web($module);
72+
is(
73+
$results->{results}->[0]->[0]->{description},
74+
'razzberry pudding',
75+
'description included in results'
76+
);
77+
}
78+
79+
{
80+
my $id = 'JatCtNR2RGjcBIs1Y5C_zTzNcXU';
81+
my $results = $search->search_descriptions($id);
82+
cmp_deeply( $results->{results}, { $id => 'TBD' },
83+
'search_descriptions' );
84+
}
85+
86+
# favorites are also tested in t/server/controller/user/favorite.t
87+
cmp_deeply( $search->search_favorites, {},
88+
'empty hashref when no distributions' );
89+
90+
cmp_deeply(
91+
$search->search_favorites('Pod-Pm'),
92+
{
93+
favorites => {},
94+
took => ignore(),
95+
},
96+
'no favorites found'
97+
);
98+
99+
cmp_deeply(
100+
$search->search_descriptions,
101+
{
102+
descriptions => {},
103+
took => ignore(),
104+
},
105+
'empty hashref when no ids for descriptions'
106+
);
105107

106108
done_testing();

0 commit comments

Comments
 (0)