Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix test t/controller/search/autocomplete.t
The way ES tokenizes the analyzed string in this search,
makes the search for 'moose">' match results for 'moose'
which is a better behavior than how it worked before.

In addition, the name prefix matching should not be
against the search string (which contains garbage) but
against the expected matching module name.
  • Loading branch information
mickeyn committed May 23, 2016
1 parent b91e868 commit 8bde030
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions t/controller/search/autocomplete.t
Expand Up @@ -7,8 +7,8 @@ use MetaCPAN::Web::Test;
use JSON::MaybeXS;

my @tests = (
[ moose => 'Moose' ],
['moose">'], # no match
[ moose => 'Moose' ],
[ 'moose">' => 'Moose' ],
[ 'Acme::ǝ' => 'Acme::ǝmɔA' ],
);

Expand Down Expand Up @@ -44,7 +44,7 @@ test_psgi app, sub {
is $doc, $exp, 'got the module we wanted first';

# if it's not exact, is it a prefix match?
like $doc, qr/^\Q$test\E/i, 'first result is a prefix match';
like $doc, qr/^\Q$exp\E/i, 'first result is a prefix match';

ok( $res = $cb->( GET "/pod/$doc" ), "GET $doc" );
is( $res->code, 200, 'code 200' );
Expand Down

0 comments on commit 8bde030

Please sign in to comment.