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().
This commit is contained in:
parent
522391bc3e
commit
ede03f4366
5 changed files with 12 additions and 11 deletions
|
@ -99,16 +99,16 @@ describe("Zotero.FeedItems", function () {
|
||||||
ids = Array.map(items, (i) => i.id);
|
ids = Array.map(items, (i) => i.id);
|
||||||
});
|
});
|
||||||
|
|
||||||
after(function() {
|
|
||||||
save.restore();
|
|
||||||
});
|
|
||||||
|
|
||||||
afterEach(function* () {
|
afterEach(function* () {
|
||||||
save.reset();
|
save.reset();
|
||||||
|
|
||||||
yield clearFeeds();
|
yield clearFeeds();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
after(function() {
|
||||||
|
save.restore();
|
||||||
|
});
|
||||||
|
|
||||||
it('should toggle all items read if at least one unread', function* () {
|
it('should toggle all items read if at least one unread', function* () {
|
||||||
items[0].isRead = false;
|
items[0].isRead = false;
|
||||||
yield items[0].saveTx();
|
yield items[0].saveTx();
|
||||||
|
|
|
@ -308,9 +308,6 @@ describe("Zotero.Feed", function() {
|
||||||
before(function() {
|
before(function() {
|
||||||
scheduleNextFeedCheck = sinon.stub(Zotero.Feeds, 'scheduleNextFeedCheck');
|
scheduleNextFeedCheck = sinon.stub(Zotero.Feeds, 'scheduleNextFeedCheck');
|
||||||
});
|
});
|
||||||
after(function() {
|
|
||||||
scheduleNextFeedCheck.restore();
|
|
||||||
});
|
|
||||||
|
|
||||||
beforeEach(function* (){
|
beforeEach(function* (){
|
||||||
scheduleNextFeedCheck.reset();
|
scheduleNextFeedCheck.reset();
|
||||||
|
@ -323,6 +320,10 @@ describe("Zotero.Feed", function() {
|
||||||
yield clearFeeds();
|
yield clearFeeds();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
after(function() {
|
||||||
|
scheduleNextFeedCheck.restore();
|
||||||
|
});
|
||||||
|
|
||||||
it('should schedule next feed check', function* () {
|
it('should schedule next feed check', function* () {
|
||||||
|
|
||||||
let feed = yield createFeed();
|
let feed = yield createFeed();
|
||||||
|
|
|
@ -54,7 +54,7 @@ describe("Sync Preferences", function () {
|
||||||
|
|
||||||
beforeEach(function* (){
|
beforeEach(function* (){
|
||||||
yield win.Zotero_Preferences.Sync.unlinkAccount(false);
|
yield win.Zotero_Preferences.Sync.unlinkAccount(false);
|
||||||
deleteAPIKey.reset();
|
deleteAPIKey.resetHistory();
|
||||||
Zotero.alert.reset();
|
Zotero.alert.reset();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -144,7 +144,7 @@ describe("Zotero.Sync.APIClient", function () {
|
||||||
if (spy) {
|
if (spy) {
|
||||||
spy.restore();
|
spy.restore();
|
||||||
}
|
}
|
||||||
delayStub.reset();
|
delayStub.resetHistory();
|
||||||
});
|
});
|
||||||
|
|
||||||
after(function () {
|
after(function () {
|
||||||
|
|
|
@ -632,7 +632,7 @@ describe("Zotero.Sync.Runner", function () {
|
||||||
assert.isTrue(stub.calledOnce);
|
assert.isTrue(stub.calledOnce);
|
||||||
assert.isFalse(group.editable);
|
assert.isFalse(group.editable);
|
||||||
|
|
||||||
stub.reset();
|
stub.restore();
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue