2 #===============================================================================
4 # FILE: Koha_ElasticSearch_Indexer.t
11 # AUTHOR: Chris Cormack (rangi), chrisc@catalyst.net.nz
12 # ORGANIZATION: Koha Development Team
14 # CREATED: 09/12/13 08:57:25
16 #===============================================================================
21 use Test::More tests => 5; # last test to print
24 use_ok('Koha::ElasticSearch::Indexer');
28 my $indexer = Koha::ElasticSearch::Indexer->new(
30 'nodes' => ['localhost:9200'],
34 'Creating new indexer object'
37 my $marc_record = MARC::Record->new();
38 my $field = MARC::Field->new( '001', '1234567' );
39 $marc_record->append_fields($field);
40 $field = MARC::Field->new( '020', '', '', 'a' => '1234567890123' );
41 $marc_record->append_fields($field);
42 $field = MARC::Field->new( '245', '', '', 'a' => 'Title' );
43 $marc_record->append_fields($field);
45 my $records = [$marc_record];
46 ok( my $converted = $indexer->convert_marc_to_json($records),
47 'Convert some records' );
49 is( $converted->count, 1, 'One converted record' );
51 ok( $indexer->update_index($records), 'Update Index' );