Skip to content

DavidFrahm/jasmine-angular-q

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

jasmine-angular-q

Note: I don't think there's much use for this library anymore, since $q.when() makes the spyOn() a one-liner, like this:

   spyOn(SomeService, 'someMethod').and.returnValue($q.when({some: "return object"}));

Helper functions for dealing with AngularJS promises in Jasmine specs

Install

Install using NPM:

$ npm install jasmine-angular-q --save-dev

Usage

spyOnAndResolve

    var firebaseAuthWithPasswordSpy = jasmineQ.spyOnAndResolve(FirebaseService.auth, '$authWithPassword', {some: "return object"}, $q);

    scope.login({some: "user credentials"});
    scope.$digest();

    expect(firebaseAuthWithPasswordSpy).toHaveBeenCalled();
    expect(scope.success).toBe(true);

TODO: Add example of other matchers here.

About

Helper functions for dealing with AngularJS promises in Jasmine specs

Resources

Stars

Watchers

Forks

Packages

No packages published