Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sandbox.stub(Cars, "findOne",
- () => {return car1 });
- Cars.find().fetch()
- sandbox.stub(Cars, "find", () => {
- return {
- fetch: sinon.stub().returns(anything);
- };
- });
- //set up stub and spy
- const valSpy = sandbox.spy();
- const jQueryStub = sandbox
- .stub($.prototype, "find") // this prototype is important
- .withArgs("input[name=email]")
- .returns({ val: valSpy });
- // call function under test
- learnerAlreadyAccepted(inviteDoc);
- // check expectations
- expect(jQueryStub).to.have.been.called; // not really necessary
- expect(valSpy).to.have.been.calledWith("");
- learnerAlreadyAccepted = function(doc) {
- $("form").find("input[name=email]").val("");
- }
Add Comment
Please, Sign In to add comment