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...
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'...
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...
How do we clear the spy in a jasmine test suite programmatically? Thanks.  beforeEach(function() {   spyOn($, "ajax").andCallFake(function(params){   }) })  it("should do something", function() {   //I want to override the spy on ajax...
The following is in my controller:  $scope.addRangesAndSquare = function() {     $scope.addLeftRange();     $scope.addCenterSquare();     $scope.addRightRange(); }   And I want to spy on $scope.addLeftRange(), so that when $scope.addRangesAndSquare i...
I'm having a problem unit testing the following method:   $scope.changeLocation = function (url) {         $location.path(url).search({ ref: "outline" });     };   I've written the following unit test that currently fails with this er...

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.