Skip to content

Commit d5fd734

Browse files
pkozlowski-opensourcecrisbeto
authored andcommitted
feat(core): introduce TestBed.tick() (#60993)
This commit introduces the `TestBed.tick()` method that, similarly to the `ApplicationRef.tick()`, synchronizes state with the DOM. It can be used in unit tests to mimic framework's logic executed in production applications. The `TestBed.tick()` should be used instead of the removed `TestBed.flushEffects()`. BREAKING CHANGE: the `TestBed.flushEffects()` was removed - use the `TestBed.tick()` instead. PR Close #60993
1 parent ccc5cc0 commit d5fd734

File tree

2 files changed

+0
-22
lines changed

2 files changed

+0
-22
lines changed

‎goldens/public-api/core/testing/index.api.md

-2
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,6 @@ export interface TestBed {
118118
createComponent<T>(component: Type<T>): ComponentFixture<T>;
119119
// (undocumented)
120120
execute(tokens: any[], fn: Function, context?: any): any;
121-
// @deprecated
122-
flushEffects(): void;
123121
initTestEnvironment(ngModule: Type<any> | Type<any>[], platform: PlatformRef, options?: TestEnvironmentOptions): void;
124122
// (undocumented)
125123
inject<T>(token: ProviderToken<T>, notFoundValue: undefined, options: InjectOptions & {

‎packages/core/testing/src/test_bed.ts

-20
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,6 @@ export interface TestBed {
152152

153153
createComponent<T>(component: Type<T>): ComponentFixture<T>;
154154

155-
/**
156-
* Execute any pending effects.
157-
*
158-
* @deprecated use `TestBed.tick()` instead
159-
*/
160-
flushEffects(): void;
161-
162155
/**
163156
* Execute any pending work required to synchronize model to the UI.
164157
*
@@ -398,10 +391,6 @@ export class TestBedImpl implements TestBed {
398391
return TestBedImpl.INSTANCE.ngModule;
399392
}
400393

401-
static flushEffects(): void {
402-
return TestBedImpl.INSTANCE.flushEffects();
403-
}
404-
405394
static tick(): void {
406395
return TestBedImpl.INSTANCE.tick();
407396
}
@@ -812,15 +801,6 @@ export class TestBedImpl implements TestBed {
812801
}
813802
}
814803

815-
/**
816-
* Execute any pending effects.
817-
*
818-
* @deprecated use `TestBed.tick()` instead
819-
*/
820-
flushEffects(): void {
821-
this.inject(EffectScheduler).flush();
822-
}
823-
824804
/**
825805
* Execute any pending work required to synchronize model to the UI.
826806
*

0 commit comments

Comments
 (0)