Skip to content

Commit 38feab9

Browse files
committed
Add unit test for catch
1 parent 49aa4c6 commit 38feab9

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test/promise.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,18 @@ describe('promise', function() {
1111
});
1212
});
1313

14+
describe('catch', function(){
15+
it('shoud catch exception.', function(done) {
16+
var promise = new AV.Promise(function(resolve) {
17+
throw 'test error';
18+
});
19+
promise.catch(function(error) {
20+
expect(error).to.be('test error');
21+
done();
22+
});
23+
});
24+
});
25+
1426
describe('always and finally', function(){
1527
it('should call always and finally', function(done){
1628
var p = new AV.Promise(function(resolve, reject) {

0 commit comments

Comments
 (0)