Reputation: 1578
this.result = new Promise( function( resolve, reject ){
self.resolveMethod = resolve;
self.rejectMethod = reject;
});
How can I test resolveMethod and rejectMethod are functions? Thanks
Upvotes: 2
Views: 121
Reputation: 1578
This is working for me
describe('result', function() {
it('should assign resolve function to resolveMethod', function() {
expect( instance.resolveMethod ).toEqual( jasmine.any(Function) );
});
it('should assign reject function to rejectMethod', function() {
expect( instance.rejectMethod ).toEqual( jasmine.any(Function) );
});
});
Upvotes: 0
Reputation: 820
You could try something like:
expect(type(result.resolveMethod).toBe('function');
expect(type(result.rejectMethod).toBe('function');
Upvotes: 0
Reputation: 5357
Use this helper method and assert.
function isFunctionA(object) {
return object && getClass.call(object) == '[object Function]';
}
Upvotes: 2