Skip to content

build: update to Angular 20-rc #4778

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/component-store/spec/integration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ describe('ComponentStore integration', () => {
'ngOnDestroy'
);

const serviceCallSpy = jest.spyOn(TestBed.get(Service), 'call');
const serviceCallSpy = jest.spyOn(TestBed.inject(Service), 'call');
return {
...setup,
destroy: () => setup.child.propsStore.ngOnDestroy(),
Expand Down
14 changes: 7 additions & 7 deletions modules/component/migrations/16_0_0/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as path from 'path';
import { waitForAsync } from '@angular/core/testing';
import {} from '@angular/core/testing';
import { Tree } from '@angular-devkit/schematics';
import {
SchematicTestRunner,
Expand Down Expand Up @@ -33,7 +33,7 @@ describe('Component Migration 16_0_0', () => {
},
].forEach(({ module, declarable }) => {
describe(`${module} => ${declarable}`, () => {
it(`should replace the ${module} in NgModule with ${declarable}`, waitForAsync(async () => {
it(`should replace the ${module} in NgModule with ${declarable}`, async () => {
const input = `
import { ${module} } from '@ngrx/component';

Expand Down Expand Up @@ -76,9 +76,9 @@ describe('Component Migration 16_0_0', () => {
const file = newTree.readContent('app.module.ts');

expect(file).toBe(expected);
}));
});

it(`should replace the ${module} in standalone component with ${declarable}`, waitForAsync(async () => {
it(`should replace the ${module} in standalone component with ${declarable}`, async () => {
const input = `
import { ${module} } from '@ngrx/component';

Expand Down Expand Up @@ -113,9 +113,9 @@ describe('Component Migration 16_0_0', () => {
const file = newTree.readContent('app.module.ts');

expect(file).toBe(expected);
}));
});

it(`should not remove the ${module} JS import when used as a type`, waitForAsync(async () => {
it(`should not remove the ${module} JS import when used as a type`, async () => {
const input = `
import { ${module} } from '@ngrx/component';

Expand Down Expand Up @@ -160,7 +160,7 @@ describe('Component Migration 16_0_0', () => {
const file = newTree.readContent('app.module.ts');

expect(file).toBe(expected);
}));
});
});
});
});
32 changes: 16 additions & 16 deletions modules/signals/rxjs-interop/spec/rx-method.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ describe('rxMethod', () => {
method(sig);
expect(results.length).toBe(0);

TestBed.flushEffects();
TestBed.tick();
expect(results[0]).toBe(1);

sig.set(10);
expect(results.length).toBe(1);

TestBed.flushEffects();
TestBed.tick();
expect(results[1]).toBe(10);
}));

Expand Down Expand Up @@ -97,18 +97,18 @@ describe('rxMethod', () => {

subject$.next(1);
sig.set(1);
TestBed.flushEffects();
TestBed.tick();
expect(results).toEqual([1, 1]);

ref1.destroy();
subject$.next(2);
sig.set(2);
TestBed.flushEffects();
TestBed.tick();
expect(results).toEqual([1, 1, 2]);

ref2.destroy();
sig.set(3);
TestBed.flushEffects();
TestBed.tick();
expect(results).toEqual([1, 1, 2]);
}));

Expand Down Expand Up @@ -195,7 +195,7 @@ describe('rxMethod', () => {
const num = signal(3);
increment(num);

TestBed.flushEffects();
TestBed.tick();
expect(counter()).toBe(4);
});

Expand Down Expand Up @@ -245,20 +245,20 @@ describe('rxMethod', () => {
globalService.trackSignal(globalService.globalSignal);
});

TestBed.flushEffects();
TestBed.tick();
expect(globalService.globalSignalChangeCounter).toBe(1);

globalService.incrementSignal();
TestBed.flushEffects();
TestBed.tick();
expect(globalService.globalSignalChangeCounter).toBe(2);

globalService.incrementSignal();
TestBed.flushEffects();
TestBed.tick();
expect(globalService.globalSignalChangeCounter).toBe(3);

instanceInjector.destroy();
globalService.incrementSignal();
TestBed.flushEffects();
TestBed.tick();

expect(globalService.globalSignalChangeCounter).toBe(3);
});
Expand All @@ -273,7 +273,7 @@ describe('rxMethod', () => {
globalService.trackObservable(globalService.globalObservable)
);

TestBed.flushEffects();
TestBed.tick();
expect(globalService.globalObservableChangeCounter).toBe(1);

globalService.incrementObservable();
Expand All @@ -298,15 +298,15 @@ describe('rxMethod', () => {
injector: instanceInjector,
});

TestBed.flushEffects();
TestBed.tick();
globalService.incrementSignal();
TestBed.flushEffects();
TestBed.tick();

expect(globalService.globalSignalChangeCounter).toBe(2);

instanceInjector.destroy();
globalService.incrementSignal();
TestBed.flushEffects();
TestBed.tick();

expect(globalService.globalSignalChangeCounter).toBe(2);
});
Expand Down Expand Up @@ -336,13 +336,13 @@ describe('rxMethod', () => {
globalService.trackSignal(globalService.globalSignal);
globalService.trackObservable(globalService.globalObservable);

TestBed.flushEffects();
TestBed.tick();
expect(globalService.globalSignalChangeCounter).toBe(1);
expect(globalService.globalObservableChangeCounter).toBe(1);

globalService.incrementSignal();
globalService.incrementObservable();
TestBed.flushEffects();
TestBed.tick();

expect(globalService.globalSignalChangeCounter).toBe(2);
expect(globalService.globalObservableChangeCounter).toBe(2);
Expand Down
2 changes: 1 addition & 1 deletion modules/signals/spec/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function createLocalService<Service extends Type<unknown>>(
return {
service: fixture.componentInstance.service,
flush: () => {
TestBed.flushEffects();
TestBed.tick();
fixture.detectChanges();
},
destroy: () => fixture.destroy(),
Expand Down
36 changes: 18 additions & 18 deletions modules/signals/spec/signal-method.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ describe('signalMethod', () => {
adder(summand);
expect(a).toBe(1);

TestBed.flushEffects();
TestBed.tick();
expect(a).toBe(2);

summand.set(2);
summand.set(2);
TestBed.flushEffects();
TestBed.tick();
expect(a).toBe(4);

TestBed.flushEffects();
TestBed.tick();
expect(a).toBe(4);
});

Expand All @@ -51,13 +51,13 @@ describe('signalMethod', () => {
adder(summand);

summand.set(2);
TestBed.flushEffects();
TestBed.tick();
expect(a).toBe(3);

adder.destroy();

summand.set(2);
TestBed.flushEffects();
TestBed.tick();
expect(a).toBe(3);
});

Expand All @@ -73,14 +73,14 @@ describe('signalMethod', () => {
const adder = createAdder((value) => (a += value));
adder(summand1);
adder(summand2);
TestBed.flushEffects();
TestBed.tick();
expect(a).toBe(4);

adder.destroy();

summand1.set(2);
summand2.set(3);
TestBed.flushEffects();
TestBed.tick();
expect(a).toBe(4);
});

Expand All @@ -98,13 +98,13 @@ describe('signalMethod', () => {
adder(summand1, { injector: childInjector });
adder(summand2);

TestBed.flushEffects();
TestBed.tick();
expect(a).toBe(4);
childInjector.destroy();

summand1.set(2);
summand2.set(2);
TestBed.flushEffects();
TestBed.tick();

adder.destroy();
expect(a).toBe(4);
Expand All @@ -122,11 +122,11 @@ describe('signalMethod', () => {
const value = signal(1);

adder(value);
TestBed.flushEffects();
TestBed.tick();

sourceInjector.destroy();
value.set(2);
TestBed.flushEffects();
TestBed.tick();

expect(a).toBe(2);
});
Expand All @@ -149,12 +149,12 @@ describe('signalMethod', () => {
TestBed.runInInjectionContext(() => {
adder(value, { injector: callerInjector });
});
TestBed.flushEffects();
TestBed.tick();
expect(a).toBe(2);

sourceInjector.destroy();
value.set(2);
TestBed.flushEffects();
TestBed.tick();

expect(a).toBe(4);
});
Expand Down Expand Up @@ -182,17 +182,17 @@ describe('signalMethod', () => {
runInInjectionContext(callerInjector, () =>
adder(value, { injector: providedInjector })
);
TestBed.flushEffects();
TestBed.tick();
expect(a).toBe(2);

sourceInjector.destroy();
value.set(2);
TestBed.flushEffects();
TestBed.tick();
expect(a).toBe(4);

callerInjector.destroy();
value.set(1);
TestBed.flushEffects();
TestBed.tick();
expect(a).toBe(5);
});
});
Expand All @@ -205,14 +205,14 @@ describe('signalMethod', () => {
adder(summand1);
const s2 = adder(summand2);

TestBed.flushEffects();
TestBed.tick();
s2.destroy();
expect(a).toBe(4);

summand1.set(100);
summand2.set(3000);

TestBed.flushEffects();
TestBed.tick();
expect(a).toBe(104);
});

Expand Down
14 changes: 7 additions & 7 deletions modules/signals/spec/signal-state.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,14 @@ describe('signalState', () => {
expect(userEmitted).toBe(0);
expect(firstNameEmitted).toBe(0);

TestBed.flushEffects();
TestBed.tick();

expect(numbersEmitted).toBe(1);
expect(userEmitted).toBe(1);
expect(firstNameEmitted).toBe(1);

patchState(state, { numbers: [1, 2, 3] });
TestBed.flushEffects();
TestBed.tick();

expect(numbersEmitted).toBe(2);
expect(userEmitted).toBe(1);
Expand All @@ -150,7 +150,7 @@ describe('signalState', () => {
patchState(state, (state) => ({
user: { ...state.user, lastName: 'Schmidt' },
}));
TestBed.flushEffects();
TestBed.tick();

expect(numbersEmitted).toBe(2);
expect(userEmitted).toBe(2);
Expand All @@ -159,7 +159,7 @@ describe('signalState', () => {
patchState(state, (state) => ({
user: { ...state.user, firstName: 'Johannes' },
}));
TestBed.flushEffects();
TestBed.tick();

expect(numbersEmitted).toBe(2);
expect(userEmitted).toBe(3);
Expand All @@ -184,17 +184,17 @@ describe('signalState', () => {
userCounter++;
});

TestBed.flushEffects();
TestBed.tick();
expect(stateCounter).toBe(1);
expect(userCounter).toBe(1);

patchState(state, {});
TestBed.flushEffects();
TestBed.tick();
expect(stateCounter).toBe(2);
expect(userCounter).toBe(1);

patchState(state, (state) => state);
TestBed.flushEffects();
TestBed.tick();
expect(stateCounter).toBe(3);
expect(userCounter).toBe(1);
}));
Expand Down
4 changes: 2 additions & 2 deletions modules/signals/spec/state-source.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,12 @@ describe('StateSource', () => {
});
});

TestBed.flushEffects();
TestBed.tick();
expect(executionCount).toBe(1);

store.setFoo('baz');

TestBed.flushEffects();
TestBed.tick();
expect(executionCount).toBe(2);
});
});
Expand Down
Loading