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...
Jasmine's spyOn is good to change a method's behavior, but is there any way to change a value property (rather than a method) for an object? the code could be like below:  spyOn(myObj, 'valueA').andReturn(1); expect(myObj.valueA).toBe...
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...
I'm testing service A, but service A depends on service B (i.e. service B is injected into service A).  I've seen this question but my case is a bit different because in my opinion it makes more sense to mock service B instead of injecting an...
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...

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.