Skip to content

Commit

Permalink
Test fixture for itemToCSLJSON with portableJSON toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
fbennett committed Dec 11, 2016
1 parent 9e98d15 commit e53c040
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion test/tests/utilitiesTest.js
Expand Up @@ -355,11 +355,32 @@ describe("Zotero.Utilities", function() {

delete newJSON.id;
delete json.id;

assert.deepEqual(newJSON, json, i + ' export -> import -> export is stable');
}

});
it("[Juris-M] with portableJSON enabled, should stably perform itemToCSLJSON -> itemFromCSLJSON -> itemToCSLJSON", function* () {
this.timeout(10000);
let data = loadSampleData('citeProcJSExport');
let portabledata = loadSampleData('citeProcJSExportPortable');

for (let i in data) {
let json = data[i];
let portablejson = portabledata[i];

var item = new Zotero.Item();
Zotero.Utilities.itemFromCSLJSON(item, json);
yield item.saveTx();

let newPortableJSON = Zotero.Utilities.itemToCSLJSON(item, true);

delete newPortableJSON.id;
delete portablejson.id;

assert.deepEqual(newPortableJSON, portablejson, i + ' export -> import -> export is stable');
}
});
it("should import exported standalone note", function* () {
let note = new Zotero.Item('note');
note.setNote('Some note longer than 50 characters, which will become the title.');
Expand Down

0 comments on commit e53c040

Please sign in to comment.