Guest User

Untitled

a guest
Jul 17th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. describe("SinonMockJQAjaxWithJasmine", function() {
  2. it("should mock a jQuery ajax request", sinon.test(function () {
  3. this.mock(jQuery).expects("ajax").once();
  4.  
  5. jQuery.ajax({
  6. url: "/something"
  7. });
  8. }));
  9.  
  10. it("should fail when expectations are not met", sinon.test(function () {
  11. this.mock(jQuery).expects("ajax").twice();
  12.  
  13. jQuery.ajax({
  14. url: "/something"
  15. });
  16. }));
  17. });
Add Comment
Please, Sign In to add comment