From f3f6a4234289c8e3afa4c11121b8623d330c662c Mon Sep 17 00:00:00 2001 From: Sonu Kapoor Date: Thu, 17 Sep 2020 18:47:41 -0400 Subject: [PATCH] test(docs-infra): replace deprecated `ReflectiveInjector` with `Injector` (#38897) This commit replaces the old and slow ReflectiveInjector that was deprecated in v5 with the new Injector. PR Close #38897 --- .../events/events.component.spec.ts | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/aio/src/app/custom-elements/events/events.component.spec.ts b/aio/src/app/custom-elements/events/events.component.spec.ts index 78a1247afe..e84f25053b 100644 --- a/aio/src/app/custom-elements/events/events.component.spec.ts +++ b/aio/src/app/custom-elements/events/events.component.spec.ts @@ -1,20 +1,22 @@ +import { Injector } from '@angular/core'; +import { Subject } from 'rxjs'; import { Duration, Event, EventsComponent } from './events.component'; import { EventsService } from './events.service'; -import { ReflectiveInjector } from '@angular/core'; -import { Subject } from 'rxjs'; describe('EventsComponent', () => { let component: EventsComponent; - let injector: ReflectiveInjector; + let injector: Injector; let eventsService: TestEventsService; beforeEach(() => { - injector = ReflectiveInjector.resolveAndCreate([ - EventsComponent, - { provide: EventsService, useClass: TestEventsService }, - ]); - eventsService = injector.get(EventsService) as any; - component = injector.get(EventsComponent); + injector = Injector.create({ + providers: [ + { provide: EventsComponent, deps: [EventsService] } , + { provide: EventsService, useClass: TestEventsService, deps: [] }, + ] + }); + eventsService = injector.get(EventsService) as unknown as TestEventsService; + component = injector.get(EventsComponent) as unknown as EventsComponent; }); it('should have no pastEvents when first created', () => {