From a413a0595fd4b5ca2572a07dd44f183563d8bbb4 Mon Sep 17 00:00:00 2001 From: Matt Blenkinsop Date: Tue, 21 May 2024 10:00:48 +0000 Subject: [PATCH] Bug 36831: Add unit test prove t/db_dependent/Koha/BackgroundJob/ImportKBARTFile.t Signed-off-by: David Nind --- .../Koha/BackgroundJob/ImportKBARTFile.t | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/Koha/BackgroundJob/ImportKBARTFile.t b/t/db_dependent/Koha/BackgroundJob/ImportKBARTFile.t index 45a8ec821a..fbe0a7f30f 100755 --- a/t/db_dependent/Koha/BackgroundJob/ImportKBARTFile.t +++ b/t/db_dependent/Koha/BackgroundJob/ImportKBARTFile.t @@ -17,7 +17,7 @@ use Modern::Perl; -use Test::More tests => 7; +use Test::More tests => 8; use Test::MockModule; use Koha::Database; @@ -111,7 +111,23 @@ Nature Astronomy,,2397-3366,2017-01,1,1,,,,https://www.nature.com/natastron,,4bb ], 'Line correctly identified' ); +}; + +subtest 'identify_delimiter' => sub { + + plan tests => 1; + + my $file = { + filename => 'Test_file.txt', + file_content => encode_base64( + 'publication_title,print_identifier,online_identifier,date_first_issue_online,num_first_vol_online,num_first_issue_online,date_last_issue_online,num_last_vol_online,num_last_issue_online,title_url,first_author,title_id,embargo_info,coverage_depth,coverage_notes,publisher_name,publication_type,date_monograph_published_print,date_monograph_published_online,monograph_volume,monograph_edition,first_editor,parent_publication_title_id,preceding_publication_title_id,access_type +Nature Plants,,2055-0278,2015-01,1,1,,,,https://www.nature.com/nplants,,4aaa7,,fulltext,Hybrid (Open Choice),Nature Publishing Group UK,serial,,,,,,,,P +Nature Astronomy,,2397-3366,2017-01,1,1,,,,https://www.nature.com/natastron,,4bbb0,,fulltext,Hybrid (Open Choice),Nature Publishing Group UK,serial,,,,,,,,P' + ) + }; + my $delimiter = Koha::BackgroundJob::ImportKBARTFile::identify_delimiter($file); + is($delimiter, ',', 'Comma delimiter identified'); }; subtest 'create_title_hash_from_line_data' => sub { -- 2.39.2