Skip to content

Commit ed0c663

Browse files
committed
fix: tests
1 parent 3733753 commit ed0c663

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

thoth-export-server/src/csv/kbart_oclc.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,10 @@ impl TryFrom<Work> for KbartOclcRow {
151151
num_last_issue_online: None,
152152
title_url: landing_page,
153153
first_author,
154-
title_id: work.titles[0].title_id.to_string(),
154+
title_id: work
155+
.doi
156+
.map(|d| d.to_string())
157+
.unwrap_or_else(|| work.titles[0].title_id.to_string()),
155158
embargo_info: None,
156159
coverage_depth: "fulltext".to_string(),
157160
notes: None,
@@ -520,9 +523,9 @@ mod tests {
520523
KbartOclc.generate(&[test_work.clone()], QuoteStyle::Necessary, DELIMITER_TAB);
521524
assert_eq!(to_test, Ok(test_result.to_string()));
522525

523-
// Remove DOI: title_id falls back to work_id
526+
// Remove DOI: title_id falls back to title_id from titles[0]
524527
test_work.doi = None;
525-
test_result.title_id = "00000000-0000-0000-aaaa-000000000001".to_string();
528+
test_result.title_id = "00000000-0000-0000-cccc-000000000001".to_string();
526529
// Remove paperback publication: date_monograph_published_print (for hardback)
527530
// still appears, but no print_identifier (paperback ISBN) is present
528531
test_work.publications.remove(2);

0 commit comments

Comments
 (0)