![]() I searched the Jasmine API but could not find out which version is the correct one. (/home/phil/workspaces/world///test/bankaccount/BankAccountCtrlTest.js:65:59)Īt Object.invoke (/home/phil/workspaces/world//bower_components/angular/angular.js:3707:17)Īt Object.workFn (/home/phil/workspaces/world//bower_components/angular-mocks/angular-mocks.js:2149:20) TypeError: 'undefined' is not an object (evaluating 'spyOn(mBankAccountResource, 'getBankAccountData').and.callFake')Īt /home/phil/workspaces/world///test/bankaccount/BankAccountCtrlTest.js:65Īt invoke (/home/phil/workspaces/world//bower_components/angular/angular.js:3707)Īt workFn (/home/phil/workspaces/world//bower_components/angular-mocks/angular-mocks.js:2149)Īrgs: (arguments) Here are the error messages: // phantomjs (with version 1) Otherwise, it complains that the function is not defined. However, when I run the same test with phantomjs, I have to use the second version. When I execute my tests with a browser (Chrome, Firefox) then the first version works. SpyOn(mBankAccountResource, 'getBankAccountData').andCallFake(fakedFunction) I want to mock test data in my Jasmine tests. Just make sure you're consistent across the board. Otherwise, downgrade your browser tests to Jasmine 1.3.1 and wait until tool support is better. If all of them do, then go for the upgrade. To solve your issue, investigate which tool(s) you're using to run tests and see if any of them support Jasmine 2.0. Support for Jasmine 2.0 in Karma, by comparison, has been out for a couple of weeks (I'm not sure about other tools). Jasmine 2.0 has only been out for a couple of months (at the time of writing). I mention tool support because it seems that's the problem you're having. SpyOn(mBankAccountResource, 'getBankAccountData').and.callFake(fakedFunction) Įxpect(().args).toEqual() Jasmine 2.0 syntax ( documentation ) // Methods moved to 'and' property Jasmine 1.3.1 syntax ( documentation ) spyOn(mBankAccountResource, 'getBankAccountData').andCallFake(fakedFunction) Įxpect().toEqual() If you can find the tool support for Jasmine 2.0, I would recommend upgrading. Yes, the spy API changed from Jasmine 1.3.1 to Jasmine 2.0.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |