Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Commit

Permalink
test(promise): add test cases for Promise.all with sync then operatio…
Browse files Browse the repository at this point in the history
…ns (#1158)
  • Loading branch information
JiaLiPassion authored and mhevery committed Mar 12, 2019
1 parent b038214 commit 0b44e83
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/common/Promise.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,26 @@ describe(
});
});

it('should resolve with the sync then operation', () => {
queueZone.run(() => {
let value = null;
const p1 = {
then: function(thenCallback: Function) {
return thenCallback('p1');
}
};
const p2 = {
then: function(thenCallback: Function) {
return thenCallback('p2');
}
};
Promise.all([p1, 'v1', p2]).then((v: any) => value = v);
// expect(Zone.current.get('queue').length).toEqual(2);
flushMicrotasks();
expect(value).toEqual(['p1', 'v1', 'p2']);
});
});

it('should resolve generators',
ifEnvSupports(
() => {
Expand Down

0 comments on commit 0b44e83

Please sign in to comment.