Test for e1986b460e (export with empty attachment path)

This commit is contained in:
Dan Stillman 2017-05-14 05:26:10 -04:00
parent 7e95f8fc51
commit f12ae67c47

View file

@ -1543,6 +1543,26 @@ describe("Zotero.Translate.ItemGetter", function() {
var exportFile = OS.Path.join(exportDir, 'export.rdf');
assert.isAbove((yield OS.File.stat(exportFile)).size, 0);
});
it("should handle empty attachment path", function* () {
var item = yield importFileAttachment('test.png');
item._attachmentPath = '';
assert.equal(item.attachmentPath, '');
var translation = new Zotero.Translate.Export();
var tmpDir = yield getTempDirectory();
var exportDir = OS.Path.join(tmpDir, 'export');
translation.setLocation(Zotero.File.pathToFile(exportDir));
translation.setItems([item]);
translation.setTranslator('14763d24-8ba0-45df-8f52-b8d1108e7ac9'); // Zotero RDF
translation.setDisplayOptions({
exportFileData: true
});
yield translation.translate();
var exportFile = OS.Path.join(exportDir, 'export.rdf');
assert.isAbove((yield OS.File.stat(exportFile)).size, 0);
});
});
});
}