commit ede03f4366dfa96edb98ab09602c3450cc6e0c21
parent 522391bc3ecf10b4cd182964b25e93ff4b4bea41
Author: Dan Stillman <dstillman@zotero.org>
Date: Thu, 1 Jun 2017 15:30:06 -0400
Update some Sinon reset() calls
In Sinon 2, reset() now resets both behavior and history, so if a stub
specifies behavior and we want to use it again, we have to call
resetHistory().
Diffstat:
5 files changed, 12 insertions(+), 11 deletions(-)
diff --git a/test/tests/feedItemsTest.js b/test/tests/feedItemsTest.js
@@ -99,16 +99,16 @@ describe("Zotero.FeedItems", function () {
ids = Array.map(items, (i) => i.id);
});
- after(function() {
- save.restore();
- });
-
afterEach(function* () {
save.reset();
yield clearFeeds();
});
-
+
+ after(function() {
+ save.restore();
+ });
+
it('should toggle all items read if at least one unread', function* () {
items[0].isRead = false;
yield items[0].saveTx();
diff --git a/test/tests/feedTest.js b/test/tests/feedTest.js
@@ -308,9 +308,6 @@ describe("Zotero.Feed", function() {
before(function() {
scheduleNextFeedCheck = sinon.stub(Zotero.Feeds, 'scheduleNextFeedCheck');
});
- after(function() {
- scheduleNextFeedCheck.restore();
- });
beforeEach(function* (){
scheduleNextFeedCheck.reset();
@@ -323,6 +320,10 @@ describe("Zotero.Feed", function() {
yield clearFeeds();
});
+ after(function() {
+ scheduleNextFeedCheck.restore();
+ });
+
it('should schedule next feed check', function* () {
let feed = yield createFeed();
diff --git a/test/tests/preferences_syncTest.js b/test/tests/preferences_syncTest.js
@@ -54,7 +54,7 @@ describe("Sync Preferences", function () {
beforeEach(function* (){
yield win.Zotero_Preferences.Sync.unlinkAccount(false);
- deleteAPIKey.reset();
+ deleteAPIKey.resetHistory();
Zotero.alert.reset();
});
diff --git a/test/tests/syncAPIClientTest.js b/test/tests/syncAPIClientTest.js
@@ -144,7 +144,7 @@ describe("Zotero.Sync.APIClient", function () {
if (spy) {
spy.restore();
}
- delayStub.reset();
+ delayStub.resetHistory();
});
after(function () {
diff --git a/test/tests/syncRunnerTest.js b/test/tests/syncRunnerTest.js
@@ -632,7 +632,7 @@ describe("Zotero.Sync.Runner", function () {
assert.isTrue(stub.calledOnce);
assert.isFalse(group.editable);
- stub.reset();
+ stub.restore();
});
})