Skip to content

Commit f63e6ca

Browse files
committed
[test] Add test for Promise.as()
1 parent ac682d7 commit f63e6ca

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

test/promise.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
describe('promise', function() {
22
describe('constructor', function(){
3-
it('shoud be resolve with 42.', function(done) {
3+
it('shoud be resolved with 42.', function(done) {
44
var promise = new AV.Promise(function(resolve) {
55
resolve(42);
66
});
@@ -11,6 +11,22 @@ describe('promise', function() {
1111
});
1212
});
1313

14+
describe('as', function() {
15+
it('should be resolved.', function(done) {
16+
AV.Promise.as(42).then(function(ret) {
17+
expect(ret).to.be(42);
18+
done();
19+
});
20+
});
21+
it('should be resolved when got a Promise.', function(done) {
22+
AV.Promise.as(Promise.resolve(42)).then(function(ret) {
23+
expect(ret).to.be(42);
24+
done();
25+
});
26+
});
27+
});
28+
29+
1430
describe('catch', function(){
1531
it('shoud catch exception.', function(done) {
1632
var promise = new AV.Promise(function(resolve) {

0 commit comments

Comments
 (0)