Fix toJSON for attachment items

This commit is contained in:
Dan Stillman 2015-08-06 15:55:37 -04:00
parent f963413170
commit 536cd867d7
3 changed files with 56 additions and 6 deletions

View file

@ -800,6 +800,21 @@ describe("Zotero.Item", function () {
assert.isTrue(json.deleted);
})
})
// TODO: Expand to all fields
it("should handle attachment fields", function* () {
var file = getTestDataDirectory();
file.append('test.png');
var item = yield Zotero.Attachments.importFromFile({
file: file
});
var json = yield item.toJSON();
assert.equal(json.linkMode, 'imported_file');
assert.equal(json.filename, 'test.png');
assert.isUndefined(json.path);
assert.equal(json.md5, '93da8f1e5774c599f0942dcecf64b11c');
assert.typeOf(json.mtime, 'number');
})
})
describe("#fromJSON()", function () {