Skip to content

Functions to help with testing promise-returning functions in jasmine

Notifications You must be signed in to change notification settings

greatvines/jasmine-promise-helpers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Jasmine Promise Helpers

Descriptions

Tiny module to make writing tests with jasmine 1.3 a little easier when using promises (actually, jQuery deferreds).

Installation

npm install --save-dev jasmine-promise-helpers

Using

var P = require('jasmine-promise-helpers');
describe('my test', function() {
	beforeEach(function() {
		spyOn(MyModule, 'myFunction').andCallFake(_(P.resolveDummyPromiseAsync).partial(42));
		spyOn(MyModule, 'myOtherFunction').andCallFake(P.rejectDummyPromiseAsync);
		runsAndWaitsFor(MyModule.testIt);
	});
	it('should call my async function', function() {
		expect(MyModule.myFunction).toHaveBeenCalled();
	});
});

About

Functions to help with testing promise-returning functions in jasmine

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published