I have an AngularJS service written and I would like to unit test it. angular.module('myServiceProvider', ['fooServiceProvider', 'barServiceProvider']). factory('myService', function ($http, fooService, barServi...
I have a Backbone Model: class DateTimeSelector extends Backbone.Model initialize: -> @bind 'change:date', @updateDatetime @bind 'change:time', @updateDatetime updateDatetime: => # do some stuff with the sate...
One of my test expects an error message text to be one of multiple values. Since getText() returns a promise I cannot use toContain() jasmine matcher. The following would not work since protractor (jasminewd under-the-hood) would not resolve a promis...
The documentation at https://github.com/pivotal/jasmine/wiki/Matchers includes the following: expect(function(){fn();}).toThrow(e); As discussed in this question, the following does not work because we want to pass a function object to expect rath...
I'm using the Jasmine BDD Javascript library and really enjoying it. I have test code that I'd like to reuse (for example, testing multiple implementations of a base class or running the same tests in a slightly different context) and I'...
I am using Jasmine to test if certain objects are created and methods are called on them. I have a jQuery widget that creates flipcounter objects and calls the setValue method on them. The code for flipcounter is here: https://bitbucket.org/cnanney...
I want to mock test data in my Jasmine tests. Here are two versions: // version 1: spyOn(mBankAccountResource, 'getBankAccountData').and.callFake(fakedFunction); // version 2: spyOn(mBankAccountResource, 'getBankAccountData').andCal...
In Angular everything seems to have a steep learning curve and unit testing an Angular app definitely doesn't escape this paradigm. When I started with TDD and Angular I felt that I was spending twice (maybe more) as much time figuring out just...
I need to set the test to succeed if one of the two expectations is met: expect(mySpy.mostRecentCall.args[0]).toEqual(jasmine.any(Number)); expect(mySpy.mostRecentCall.args[0]).toEqual(false); I expected it to look like this: expect(mySpy.mostRec...
I am trying to test a button click using backbone.js, jasmine.js and sinon.js. But the following test case fails. I am using a spy to track whether it is getting called or not. Can you please help me with this? Thanks. New Task Template <script...
©2020 All rights reserved.