Fix eslint no-unused-expressions in tests

[MAILPOET-1085]
This commit is contained in:
Pavel Dohnal
2017-09-06 15:41:41 +01:00
parent 72c0a6f165
commit 4e508855fc
6 changed files with 12 additions and 11 deletions

View File

@ -19,7 +19,6 @@
"max-len": 0, "max-len": 0,
"space-unary-ops": 0, "space-unary-ops": 0,
"no-unused-vars": 0, "no-unused-vars": 0,
"no-unused-expressions": 0,
"no-underscore-dangle": 0, "no-underscore-dangle": 0,
"no-shadow": 0, "no-shadow": 0,
"padded-blocks": 0, "padded-blocks": 0,

View File

@ -307,7 +307,7 @@ define([
}); });
it('listens to the event', function () { it('listens to the event', function () {
expect(onStub).to.have.been.calledOnce; expect(onStub).to.have.been.callCount(1);
expect(onStub).to.have.been.calledWith('replaceAllButtonStyles', sinon.match.func); expect(onStub).to.have.been.calledWith('replaceAllButtonStyles', sinon.match.func);
}); });
@ -321,7 +321,7 @@ define([
} }
}; };
callback(data); callback(data);
expect(model.set).to.have.been.calledOnce; expect(model.set).to.have.been.callCount(1);
expect(model.set).to.have.been.calledWithMatch(sinon.match.has('readMoreButton', data)); expect(model.set).to.have.been.calledWithMatch(sinon.match.has('readMoreButton', data));
}); });
}); });

View File

@ -276,7 +276,7 @@ define([
}); });
it('listens to the event', function () { it('listens to the event', function () {
expect(onStub).to.have.been.calledOnce; expect(onStub).to.have.been.callCount(1);
expect(onStub).to.have.been.calledWith('replaceAllButtonStyles', sinon.match.func); expect(onStub).to.have.been.calledWith('replaceAllButtonStyles', sinon.match.func);
}); });
@ -290,7 +290,7 @@ define([
} }
}; };
callback(data); callback(data);
expect(model.set).to.have.been.calledOnce; expect(model.set).to.have.been.callCount(1);
expect(model.set).to.have.been.calledWithExactly(data); expect(model.set).to.have.been.calledWithExactly(data);
}); });
}); });

View File

@ -254,8 +254,8 @@ define([
stub.restore(); stub.restore();
spy.restore(); spy.restore();
expect(spy.withArgs('loadingMorePosts').calledOnce).to.be.true; expect(spy.withArgs('loadingMorePosts').calledOnce).to.be.true;// eslint-disable-line no-unused-expressions
expect(spy.withArgs('morePostsLoaded').calledOnce).to.be.true; expect(spy.withArgs('morePostsLoaded').calledOnce).to.be.true;// eslint-disable-line no-unused-expressions
expect(model.get('_availablePosts').length).to.equal(3); expect(model.get('_availablePosts').length).to.equal(3);
}); });
}); });

View File

@ -33,7 +33,8 @@ define([
} }
}); });
module.save(); module.save();
expect(spy.withArgs('beforeEditorSave').calledOnce).to.be.true; expect(spy).to.have.callCount(1);
expect(spy).to.have.been.calledWith('beforeEditorSave');
}); });
it('triggers afterEditorSave event', function() { it('triggers afterEditorSave event', function() {
@ -54,7 +55,7 @@ define([
}); });
promise.resolve({ success: true }); promise.resolve({ success: true });
module.save(); module.save();
expect(spy.withArgs('afterEditorSave').calledOnce).to.be.true; expect(spy.withArgs('afterEditorSave').calledOnce).to.be.true;// eslint-disable-line no-unused-expressions
}); });
it('sends newsletter json to server for saving', function() { it('sends newsletter json to server for saving', function() {
@ -188,7 +189,8 @@ define([
view.render(); view.render();
view.$('.mailpoet_save_next').click(); view.$('.mailpoet_save_next').click();
expect(spy.withArgs('beforeEditorSave').calledOnce).to.be.true; expect(spy).to.have.callCount(1);
expect(spy).to.have.been.calledWith('beforeEditorSave');
}); });
}); });