diff --git a/packages/schematics/angular/guard/index_spec.ts b/packages/schematics/angular/guard/index_spec.ts index ebf85dd23529..1712894e4098 100644 --- a/packages/schematics/angular/guard/index_spec.ts +++ b/packages/schematics/angular/guard/index_spec.ts @@ -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));', ); }); diff --git a/packages/schematics/angular/guard/type-files/__name@dasherize__.guard.spec.ts.template b/packages/schematics/angular/guard/type-files/__name@dasherize__.guard.spec.ts.template index 4cbcd9b606d6..b0fec06cf415 100644 --- a/packages/schematics/angular/guard/type-files/__name@dasherize__.guard.spec.ts.template +++ b/packages/schematics/angular/guard/type-files/__name@dasherize__.guard.spec.ts.template @@ -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({}); diff --git a/packages/schematics/angular/resolver/functional-files/__name@dasherize__.resolver.spec.ts.template b/packages/schematics/angular/resolver/functional-files/__name@dasherize__.resolver.spec.ts.template index 9b521b298d4d..32cc699ae35d 100644 --- a/packages/schematics/angular/resolver/functional-files/__name@dasherize__.resolver.spec.ts.template +++ b/packages/schematics/angular/resolver/functional-files/__name@dasherize__.resolver.spec.ts.template @@ -5,7 +5,7 @@ import { <%= camelize(name) %>Resolver } from './<%= dasherize(name) %>.resolver describe('<%= camelize(name) %>Resolver', () => { const executeResolver: ResolveFn = (...resolverParameters) => - TestBed.inject(EnvironmentInjector).runInContext(() => <%= camelize(name) %>Resolver(...resolverParameters)); + TestBed.runInInjectionContext(() => <%= camelize(name) %>Resolver(...resolverParameters)); beforeEach(() => { TestBed.configureTestingModule({}); diff --git a/packages/schematics/angular/resolver/index_spec.ts b/packages/schematics/angular/resolver/index_spec.ts index 95f1bdde8305..01c17bda6668 100644 --- a/packages/schematics/angular/resolver/index_spec.ts +++ b/packages/schematics/angular/resolver/index_spec.ts @@ -99,7 +99,7 @@ describe('resolver Schematic', () => { 'const executeResolver: ResolveFn = (...resolverParameters) => ', ); expect(fileString).toContain( - 'TestBed.inject(EnvironmentInjector).runInContext(() => fooResolver(...resolverParameters));', + 'TestBed.runInInjectionContext(() => fooResolver(...resolverParameters));', ); }); });