Bug 42485: (QA follow-up) Add explicit JSON::PP import and test coverage
Add explicit `use JSON::PP ()` to Elasticsearch.pm and the test file to make the dependency on JSON::PP::false visible rather than relying on YAML::XS loading it as a side effect. Extend the get_elasticsearch_mappings() test subtest to assert that date_detection and numeric_detection are disabled at the mapping root. Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
parent
78850b4a15
commit
40b9e8abd5
|
|
@ -58,6 +58,7 @@ use Search::Elasticsearch::Role::Cxn;
|
|||
}
|
||||
|
||||
use Try::Tiny qw( catch try );
|
||||
use JSON::PP ();
|
||||
use YAML::XS;
|
||||
|
||||
use List::Util qw( sum0 );
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ use t::lib::TestBuilder;
|
|||
|
||||
use Test::MockModule;
|
||||
|
||||
use JSON::PP ();
|
||||
use MARC::Record;
|
||||
use Try::Tiny;
|
||||
use List::Util qw( any );
|
||||
|
|
@ -144,7 +145,7 @@ subtest 'get_elasticsearch_settings() tests' => sub {
|
|||
|
||||
subtest 'get_elasticsearch_mappings() tests' => sub {
|
||||
|
||||
plan tests => 3;
|
||||
plan tests => 5;
|
||||
|
||||
my $mappings;
|
||||
|
||||
|
|
@ -206,6 +207,14 @@ subtest 'get_elasticsearch_mappings() tests' => sub {
|
|||
'Field mappings parsed correctly for sort for callnumber type'
|
||||
);
|
||||
is( $mappings->{properties}{isbn__sort}{index}, 'false', 'Field mappings parsed correctly' );
|
||||
is(
|
||||
$mappings->{date_detection}, JSON::PP::false,
|
||||
'date_detection disabled at mapping root'
|
||||
);
|
||||
is(
|
||||
$mappings->{numeric_detection}, JSON::PP::false,
|
||||
'numeric_detection disabled at mapping root'
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue