diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/ng/qSpec.js | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/test/ng/qSpec.js b/test/ng/qSpec.js index bad67dcc..13c51f4b 100644 --- a/test/ng/qSpec.js +++ b/test/ng/qSpec.js @@ -730,6 +730,38 @@ describe('q', function() { mockNextTick.flush(); expect(log).toEqual(['error(oops!)->reject(oops!)']); }); + + it('should forward success resolution when success callbacks are not functions', function() { + deferred.resolve('yay!'); + + promise.then(1). + then(null). + then({}). + then('gah!'). + then([]). + then(success()); + + expect(logStr()).toBe(''); + + mockNextTick.flush(); + expect(log).toEqual(['success(yay!)->yay!']); + }); + + it('should forward error resolution when error callbacks are not functions', function() { + deferred.reject('oops!'); + + promise.then(null, 1). + then(null, null). + then(null, {}). + then(null, 'gah!'). + then(null, []). + then(null, error()); + + expect(logStr()).toBe(''); + + mockNextTick.flush(); + expect(log).toEqual(['error(oops!)->reject(oops!)']); + }); }); |
