diff --git a/chrome/content/zotero/xpcom/http.js b/chrome/content/zotero/xpcom/http.js index 55dd43e73c..4ff9675008 100644 --- a/chrome/content/zotero/xpcom/http.js +++ b/chrome/content/zotero/xpcom/http.js @@ -376,7 +376,11 @@ Zotero.HTTP = new function() { } } for (var header in headers) { - xmlhttp.setRequestHeader(header, headers[header]); + // Convert numbers to string to make Sinon happy + let value = typeof headers[header] == 'number' + ? headers[header].toString() + : headers[header] + xmlhttp.setRequestHeader(header, value); } // Set timeout diff --git a/test/tests/feedItemTest.js b/test/tests/feedItemTest.js index 054544e348..16748e475e 100644 --- a/test/tests/feedItemTest.js +++ b/test/tests/feedItemTest.js @@ -218,7 +218,7 @@ describe("Zotero.FeedItem", function () { yield item.toggleRead(true); assert.isTrue(item.save.called, "item was saved on toggle read"); - item.save.reset(); + item.save.resetHistory(); yield item.toggleRead(true); assert.isFalse(item.save.called, "item was not saved on toggle read to same state"); diff --git a/test/tests/feedItemsTest.js b/test/tests/feedItemsTest.js index c318a5cbd3..fc0eae6ff0 100644 --- a/test/tests/feedItemsTest.js +++ b/test/tests/feedItemsTest.js @@ -100,7 +100,7 @@ describe("Zotero.FeedItems", function () { }); afterEach(function* () { - save.reset(); + save.resetHistory(); yield clearFeeds(); }); diff --git a/test/tests/integrationTest.js b/test/tests/integrationTest.js index dc14360708..7269ce1926 100644 --- a/test/tests/integrationTest.js +++ b/test/tests/integrationTest.js @@ -355,7 +355,7 @@ describe("Zotero.Integration", function () { }); afterEach(function() { - setDocumentDataSpy.reset(); + setDocumentDataSpy.resetHistory(); }); after(function() { @@ -385,7 +385,7 @@ describe("Zotero.Integration", function () { } catch (e) {} await initDoc(docID, {style}); displayDialogStub.resetHistory(); - displayAlertStub.reset(); + displayAlertStub.resetHistory(); }); after(function* () { @@ -559,7 +559,7 @@ describe("Zotero.Integration", function () { assert.isTrue(getCiteprocBibliographySpy.calledOnce); assert.equal(getCiteprocBibliographySpy.lastCall.returnValue[0].entry_ids.length, 3); - getCiteprocBibliographySpy.reset(); + getCiteprocBibliographySpy.resetHistory(); setAddEditItems(testItems[3]); yield execCommand('addEditCitation', docID); @@ -580,7 +580,7 @@ describe("Zotero.Integration", function () { assert.isTrue(getCiteprocBibliographySpy.calledOnce); assert.equal(getCiteprocBibliographySpy.lastCall.returnValue[0].entry_ids.length, 3); - getCiteprocBibliographySpy.reset(); + getCiteprocBibliographySpy.resetHistory(); sinon.stub(doc, 'cursorInField').resolves(doc.fields[1]); sinon.stub(doc, 'canInsertField').resolves(false); @@ -603,7 +603,7 @@ describe("Zotero.Integration", function () { displayAlertStub = sinon.stub(DocumentPluginDummy.Document.prototype, 'displayAlert').resolves(0); }); beforeEach(function() { - displayAlertStub.reset(); + displayAlertStub.resetHistory(); }); after(function() { displayAlertStub.restore(); diff --git a/test/tests/itemTreeViewTest.js b/test/tests/itemTreeViewTest.js index 5d2eb6630a..838f94ddeb 100644 --- a/test/tests/itemTreeViewTest.js +++ b/test/tests/itemTreeViewTest.js @@ -147,7 +147,7 @@ describe("Zotero.ItemTreeView", function() { assert.equal(selected[0], existingItemID); // Reset call count on spy - win.ZoteroPane.itemSelected.reset(); + win.ZoteroPane.itemSelected.resetHistory(); // Create item with skipNotifier flag var item = new Zotero.Item('book'); @@ -172,7 +172,7 @@ describe("Zotero.ItemTreeView", function() { assert.equal(selected[0], existingItemID); // Reset call count on spy - win.ZoteroPane.itemSelected.reset(); + win.ZoteroPane.itemSelected.resetHistory(); // Create item with skipSelect flag var item = new Zotero.Item('book'); @@ -267,7 +267,7 @@ describe("Zotero.ItemTreeView", function() { itemsView.selection.clearSelection(); assert.lengthOf(itemsView.getSelectedItems(), 0); // Reset call count on spy - win.ZoteroPane.itemSelected.reset(); + win.ZoteroPane.itemSelected.resetHistory(); // Modify item item.setField('title', 'no select on modify'); @@ -293,7 +293,7 @@ describe("Zotero.ItemTreeView", function() { assert.equal(selected[0], id); // Reset call count on spy - win.ZoteroPane.itemSelected.reset(); + win.ZoteroPane.itemSelected.resetHistory(); // Modify item item.setField('title', 'maintain selection on modify');