Skip to content

Commit

Permalink
test(core): Wait for zone stability before test completion
Browse files Browse the repository at this point in the history
Need to wait for microtaskEmty to emit or test will leak into others.
  • Loading branch information
atscott committed Apr 22, 2024
1 parent 9894278 commit f597406
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/core/test/zone/ng_zone_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import {EventEmitter, NgZone} from '@angular/core';
import {fakeAsync, flushMicrotasks, inject, waitForAsync} from '@angular/core/testing';
import {Log} from '@angular/core/testing/src/testing_internal';
import {firstValueFrom} from 'rxjs';

import {scheduleCallbackWithRafRace as scheduler} from '../../src/util/callback_scheduler';
import {global} from '../../src/util/global';
Expand Down Expand Up @@ -1193,10 +1194,11 @@ function commonTests() {
});
});

it('does not throw when apply args array has `undefined`', () => {
it('does not throw when apply args array has `undefined`', async () => {
expect(() => {
coalesceZone.run(function(this: any, arg: any) {}, undefined, [undefined]);
}).not.toThrow();
await firstValueFrom(coalesceZone.onMicrotaskEmpty);
});
});
});
Expand Down

0 comments on commit f597406

Please sign in to comment.