Skip to content

Commit

Permalink
added testcase for parent field
Browse files Browse the repository at this point in the history
  • Loading branch information
JawadTUE committed Nov 12, 2023
1 parent 6a8807a commit 92f9841
Showing 1 changed file with 31 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -183,4 +183,35 @@ void passesModifiedCharsetNull(@TempDir Path tempFile) throws Exception {
"---");
assertEquals(expected, Files.readAllLines(file));
}

@Test
public final void exportsCorrectParentField(@TempDir Path tempFile) throws Exception {
BibEntry entry = new BibEntry(StandardEntryType.Article)
.withCitationKey("test")
.withField(StandardField.AUTHOR, "Test Author")
.withField(StandardField.TITLE, "Test Title")
.withField(StandardField.JOURNAL, "Test Publisher")
.withField(StandardField.URL, "http://example.com")
.withField(StandardField.DATE, "2020-10-14");

Path file = tempFile.resolve("RandomFileName");
Files.createFile(file);
hayagrivaYamlExporter.export(databaseContext, file, Collections.singletonList(entry));

List<String> expected = List.of(
"---",
"test:",
" type: article",
" title: \"Test Title\"",
" author:",
" - Author, Test",
" date: 2020-10-14",
" parent:",
" type: periodical",
" title: Test Publisher",
" url: http://example.com",
"---");

assertEquals(expected, Files.readAllLines(file));
}
}

0 comments on commit 92f9841

Please sign in to comment.