diff --git a/src/test/java/org/jabref/logic/exporter/HayagrivaYamlExporterTest.java b/src/test/java/org/jabref/logic/exporter/HayagrivaYamlExporterTest.java index 7a058ec059d..0b6356906e9 100644 --- a/src/test/java/org/jabref/logic/exporter/HayagrivaYamlExporterTest.java +++ b/src/test/java/org/jabref/logic/exporter/HayagrivaYamlExporterTest.java @@ -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 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)); + } }