define(['backbone', 'jquery', 'js/verify_student/photocapture'], function (Backbone, $) { describe("Photo Verification", function () { beforeEach(function () { setFixtures(''); }); it('retake photo', function () { spyOn(window, "refereshPageMessage").andCallFake(function () { return; }); spyOn($, "ajax").andCallFake(function (e) { e.success({"success": false}); }); submitToPaymentProcessing(); expect(window.refereshPageMessage).toHaveBeenCalled(); }); it('successful submission', function () { spyOn(window, "submitForm").andCallFake(function () { return; }); spyOn($, "ajax").andCallFake(function (e) { e.success({"success": true}); }); submitToPaymentProcessing(); expect(window.submitForm).toHaveBeenCalled(); }); it('Error during process', function () { spyOn(window, "showSubmissionError").andCallFake(function () { return; }); spyOn($, "ajax").andCallFake(function (e) { e.error({}); }); submitToPaymentProcessing(); expect(window.showSubmissionError).toHaveBeenCalled(); }); }); });