Bug 38416: Add unit tests
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
parent
0d862343dd
commit
a9eaefa3b8
|
|
@ -186,7 +186,7 @@ subtest 'get_elasticsearch_mappings() tests' => sub {
|
|||
|
||||
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests' => sub {
|
||||
|
||||
plan tests => 66;
|
||||
plan tests => 69;
|
||||
|
||||
t::lib::Mocks::mock_preference('marcflavour', 'MARC21');
|
||||
t::lib::Mocks::mock_preference('ElasticsearchMARCFormat', 'ISO2709');
|
||||
|
|
@ -752,6 +752,25 @@ subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests'
|
|||
is_deeply( $docs->[0]->{author},[],'No value placed into field if mapped marc field is blank');
|
||||
is_deeply( $docs->[0]->{author__suggestion},[],'No value placed into suggestion if mapped marc field is blank');
|
||||
|
||||
my $marc_record_with_large_field = MARC::Record->new();
|
||||
$marc_record_with_large_field->leader(' cam 22 a 4500');
|
||||
|
||||
$marc_record_with_large_field->append_fields(
|
||||
MARC::Field->new('100', '', '', a => 'Author 1'),
|
||||
MARC::Field->new('245', '', '', a => 'Title:', b => 'record with large field'),
|
||||
MARC::Field->new('500', '', '', a => 'X' x 15000),
|
||||
MARC::Field->new('999', '', '', c => '1234567'),
|
||||
);
|
||||
|
||||
$docs = $see->marc_records_to_documents([$marc_record_with_large_field]);
|
||||
|
||||
is($docs->[0]->{marc_format}, 'MARCXML', 'For record with large field marc_format should be set correctly');
|
||||
|
||||
$decoded_marc_record = $see->decode_record_from_result($docs->[0]);
|
||||
|
||||
ok($decoded_marc_record->isa('MARC::Record'), "MARCXML record successfully decoded from result");
|
||||
is($decoded_marc_record->as_xml_record(), $marc_record_with_large_field->as_xml_record(), "Decoded MARCXML record has same data as original record");
|
||||
|
||||
};
|
||||
|
||||
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents_array () tests' => sub {
|
||||
|
|
|
|||
Loading…
Reference in New Issue