Skip to content
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

refactor(@schematics/angular): Use runInInjectionContext shorthand #24314

Merged
merged 1 commit into from Nov 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/schematics/angular/guard/index_spec.ts
Expand Up @@ -109,7 +109,7 @@ describe('Guard Schematic', () => {
const fileString = tree.readContent('/projects/bar/src/app/foo.guard.spec.ts');
expect(fileString).toContain('const executeGuard: CanActivateFn = (...guardParameters) => ');
expect(fileString).toContain(
'TestBed.inject(EnvironmentInjector).runInContext(() => fooGuard(...guardParameters));',
'TestBed.runInInjectionContext(() => fooGuard(...guardParameters));',
);
});

Expand Down
Expand Up @@ -6,7 +6,7 @@ import { <%= camelize(name) %>Guard } from './<%= dasherize(name) %>.guard';

describe('<%= camelize(name) %>Guard', () => {
const executeGuard: <%= guardType %> = (...guardParameters) =>
TestBed.inject(EnvironmentInjector).runInContext(() => <%= camelize(name) %>Guard(...guardParameters));
TestBed.runInInjectionContext(() => <%= camelize(name) %>Guard(...guardParameters));

beforeEach(() => {
TestBed.configureTestingModule({});
Expand Down
Expand Up @@ -5,7 +5,7 @@ import { <%= camelize(name) %>Resolver } from './<%= dasherize(name) %>.resolver

describe('<%= camelize(name) %>Resolver', () => {
const executeResolver: ResolveFn<boolean> = (...resolverParameters) =>
TestBed.inject(EnvironmentInjector).runInContext(() => <%= camelize(name) %>Resolver(...resolverParameters));
TestBed.runInInjectionContext(() => <%= camelize(name) %>Resolver(...resolverParameters));

beforeEach(() => {
TestBed.configureTestingModule({});
Expand Down
2 changes: 1 addition & 1 deletion packages/schematics/angular/resolver/index_spec.ts
Expand Up @@ -99,7 +99,7 @@ describe('resolver Schematic', () => {
'const executeResolver: ResolveFn<boolean> = (...resolverParameters) => ',
);
expect(fileString).toContain(
'TestBed.inject(EnvironmentInjector).runInContext(() => fooResolver(...resolverParameters));',
'TestBed.runInInjectionContext(() => fooResolver(...resolverParameters));',
);
});
});