Lines 117-123
subtest 'get_elasticsearch_mappings() tests' => sub {
Link Here
|
117 |
|
117 |
|
118 |
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests' => sub { |
118 |
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests' => sub { |
119 |
|
119 |
|
120 |
plan tests => 45; |
120 |
plan tests => 32; |
121 |
|
121 |
|
122 |
t::lib::Mocks::mock_preference('marcflavour', 'MARC21'); |
122 |
t::lib::Mocks::mock_preference('marcflavour', 'MARC21'); |
123 |
|
123 |
|
Lines 131-136
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests'
Link Here
|
131 |
marc_type => 'marc21', |
131 |
marc_type => 'marc21', |
132 |
marc_field => '001', |
132 |
marc_field => '001', |
133 |
}, |
133 |
}, |
|
|
134 |
{ |
135 |
name => 'isbn', |
136 |
type => 'isbn', |
137 |
facet => 0, |
138 |
suggestible => 0, |
139 |
sort => 0, |
140 |
marc_type => 'marc21', |
141 |
marc_field => '020a', |
142 |
}, |
134 |
{ |
143 |
{ |
135 |
name => 'author', |
144 |
name => 'author', |
136 |
type => 'string', |
145 |
type => 'string', |
Lines 246-251
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests'
Link Here
|
246 |
$marc_record_1->leader(' cam 22 a 4500'); |
255 |
$marc_record_1->leader(' cam 22 a 4500'); |
247 |
$marc_record_1->append_fields( |
256 |
$marc_record_1->append_fields( |
248 |
MARC::Field->new('001', '123'), |
257 |
MARC::Field->new('001', '123'), |
|
|
258 |
MARC::Field->new('020', '', '', a => '1-56619-909-3'), |
249 |
MARC::Field->new('100', '', '', a => 'Author 1'), |
259 |
MARC::Field->new('100', '', '', a => 'Author 1'), |
250 |
MARC::Field->new('110', '', '', a => 'Corp Author'), |
260 |
MARC::Field->new('110', '', '', a => 'Corp Author'), |
251 |
MARC::Field->new('210', '', '', a => 'Title 1'), |
261 |
MARC::Field->new('210', '', '', a => 'Title 1'), |
Lines 271-277
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests'
Link Here
|
271 |
my $docs = $see->marc_records_to_documents($records); |
281 |
my $docs = $see->marc_records_to_documents($records); |
272 |
|
282 |
|
273 |
# First record: |
283 |
# First record: |
274 |
|
|
|
275 |
is(scalar @{$docs}, 2, 'Two records converted to documents'); |
284 |
is(scalar @{$docs}, 2, 'Two records converted to documents'); |
276 |
|
285 |
|
277 |
is($docs->[0][0], '1234567', 'First document biblionumber should be set as first element in document touple'); |
286 |
is($docs->[0][0], '1234567', 'First document biblionumber should be set as first element in document touple'); |
Lines 360-365
subtest 'Koha::SearchEngine::Elasticsearch::marc_records_to_documents () tests'
Link Here
|
360 |
'First document type_of_record_and_bib_level field should be set correctly' |
369 |
'First document type_of_record_and_bib_level field should be set correctly' |
361 |
); |
370 |
); |
362 |
|
371 |
|
|
|
372 |
is(scalar @{$docs->[0][1]->{isbn}}, 4, 'First document isbn field should contain four values'); |
373 |
is_deeply($docs->[0][1]->{isbn}, ['978-1-56619-909-4', '9781566199094', '1-56619-909-3', '1566199093'], 'First document isbn field should be set correctly'); |
374 |
|
363 |
# Second record: |
375 |
# Second record: |
364 |
|
376 |
|
365 |
is(scalar @{$docs->[1][1]->{author}}, 1, 'Second document author field should contain one value'); |
377 |
is(scalar @{$docs->[1][1]->{author}}, 1, 'Second document author field should contain one value'); |
366 |
- |
|
|