chore($q): replace plain TypeError with minErr+TypeError in cyclical resolve check

This commit is contained in:
Jeff Cross
2014-08-21 16:02:04 -07:00
parent 1b331f3729
commit 0462b688f9
3 changed files with 48 additions and 3 deletions

View File

@@ -815,6 +815,20 @@ describe('q', function() {
});
it('should complain if promise fulfilled with itself', function() {
var resolveSpy = jasmine.createSpy('resolve');
var rejectSpy = jasmine.createSpy('reject');
promise.then(resolveSpy, rejectSpy);
deferred.resolve(deferred.promise);
mockNextTick.flush();
expect(resolveSpy).not.toHaveBeenCalled();
expect(rejectSpy).toHaveBeenCalled();
expect(rejectSpy.calls[0].args[0].message).
toMatch(/\[\$q\:qcycle\] Expected promise to be resolved with value other than itself/);
});
it('should do nothing if a promise was previously resolved', function() {
promise.then(success(), error());
expect(logStr()).toBe('');