Skip to content

Commit

Permalink
Test for e1986b4 (export with empty attachment path)
Browse files Browse the repository at this point in the history
  • Loading branch information
dstillman committed May 14, 2017
1 parent 7e95f8f commit f12ae67
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/tests/translateTest.js
Expand Up @@ -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);
});
});
});
}

0 comments on commit f12ae67

Please sign in to comment.