Sinon.JS – How can I get arguments from a stub?
Thanks to Matt Mokary (if you want to submit an answer I’ll give you the credit for this one) I edited my test as follows… it(“Can show a fail message”, Sinon.test(function() { $(“body”).append(`<a class=”js-delete-button” data-id=”123″ data-delete-uri=”/delete/123″>Delete</a>`); let objUt = new DeleteButton($(“.js-delete-button”).get()[0]); let bootboxAlertStub = this.stub(Bootbox, ‘alert’); objUt.showFailed(); Sinon.assert.called(bootboxAlertStub); let options = bootboxAlertStub.getCall(0).args[0]; expect(options.message).to.equal(objUt.errorMessage); })); The … Read more