Skip to content

Commit

Permalink
Spec thenable assimilation in allResolved per kriskowal#179
Browse files Browse the repository at this point in the history
  • Loading branch information
kriskowal committed Jan 27, 2013
1 parent 2967c15 commit 7bc8e07
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions spec/q-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1520,6 +1520,34 @@ describe("thenables", function () {
});
});

it("assimilates a thenable in allResolved", function () {
return Q.allResolved([
{then: function (win, fail) {
win(10);
}}
])
.then(function (promises) {
expect(promises[0].isPending()).toBe(false);
expect(promises[0].isFulfilled()).toBe(true);
expect(promises[0].isRejected()).toBe(false);
});
});

it("assimilates a pending thenable in allResolved", function () {
return Q.allResolved([
{then: function (win, fail) {
setTimeout(function () {
win(10);
}, 100);
}}
])
.then(function (promises) {
expect(promises[0].isPending()).toBe(false);
expect(promises[0].isFulfilled()).toBe(true);
expect(promises[0].isRejected()).toBe(false);
});
});

});

describe("node support", function () {
Expand Down

0 comments on commit 7bc8e07

Please sign in to comment.