Bug 19559: Add tests
authorNick Clemens <nick@bywatersolutions.com>
Wed, 1 Nov 2017 15:46:59 +0000 (15:46 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Sun, 26 Nov 2017 15:59:31 +0000 (12:59 -0300)
Signed-off-by: David Bourgault <david.bourgault@inlibro.com>
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
t/db_dependent/Koha_SearchEngine_Elasticsearch_Search.t

index b96a8b3..a167f5d 100644 (file)
@@ -81,7 +81,7 @@ subtest 'json2marc' => sub {
 };
 
 subtest 'build_query tests' => sub {
-    plan tests => 18;
+    plan tests => 20;
 
     t::lib::Mocks::mock_preference('DisplayLibraryFacets','both');
     my $query = $builder->build_query();
@@ -172,6 +172,20 @@ subtest 'build_query tests' => sub {
         "query of specific field is truncated"
     );
 
+    ( undef, $query ) = $builder->build_query_compat( undef, ['Local-number:"123456"'] );
+    is(
+        $query->{query}{query_string}{query},
+        '(Local-number:"123456")',
+        "query of specific field including hyphen and quoted is not truncated"
+    );
+
+    ( undef, $query ) = $builder->build_query_compat( undef, ['Local-number:123456'] );
+    is(
+        $query->{query}{query_string}{query},
+        '(Local-number:123456*)',
+        "query of specific field including hyphen and not quoted is truncated"
+    );
+
     ( undef, $query ) = $builder->build_query_compat( undef, ['title:"donald duck"'] );
     is(
         $query->{query}{query_string}{query},