Skip to content

Commit 411c18f

Browse files
committed
tests: add es2017 zone tests
1 parent 645d729 commit 411c18f

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

apps/nativescript-demo-ng/src/tests/zone-tests.spec.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,4 +123,26 @@ describe('Zone patches', () => {
123123
expect(() => obs.removeEventListener('testEvent', callback)).not.toThrow();
124124
expect(() => obs.removeEventListener('testEvent')).not.toThrow();
125125
});
126+
127+
it('should maintain zone with promises', (done) => {
128+
const parentZone = createZone('parent');
129+
parentZone.run(async () => {
130+
expect(Zone.current.name).toBe('parent');
131+
Promise.resolve().then(() => {
132+
expect(Zone.current.name).toBe('parent');
133+
done();
134+
});
135+
expect(Zone.current.name).toBe('parent');
136+
});
137+
});
138+
139+
it('should downlevel async/await', (done) => {
140+
const parentZone = createZone('parent');
141+
parentZone.run(async () => {
142+
expect(Zone.current.name).toBe('parent');
143+
await Promise.resolve();
144+
expect(Zone.current.name).toBe('parent');
145+
done();
146+
});
147+
});
126148
});

0 commit comments

Comments
 (0)