From 3ec4f613576efec43696138ba557b06aa631a0fb Mon Sep 17 00:00:00 2001 From: cexbrayat Date: Thu, 17 Oct 2019 17:05:29 +0200 Subject: [PATCH] fix(@schematics/angular): remove unneeded debugElement in test The generate tests in `app.component.spec.ts` are using `fixture.debugElement.componentInstance` whereas we can directly use `fixture.componentInstance`. This fixes the generated test to show a better example to users discovering unit tests. --- .../application/other-files/app.component.spec.ts.template | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/schematics/angular/application/other-files/app.component.spec.ts.template b/packages/schematics/angular/application/other-files/app.component.spec.ts.template index 9ffbfc0a31..08513f4420 100644 --- a/packages/schematics/angular/application/other-files/app.component.spec.ts.template +++ b/packages/schematics/angular/application/other-files/app.component.spec.ts.template @@ -16,20 +16,20 @@ describe('AppComponent', () => { it('should create the app', () => { const fixture = TestBed.createComponent(AppComponent); - const app = fixture.debugElement.componentInstance; + const app = fixture.componentInstance; expect(app).toBeTruthy(); }); it(`should have as title '<%= name %>'`, () => { const fixture = TestBed.createComponent(AppComponent); - const app = fixture.debugElement.componentInstance; + const app = fixture.componentInstance; expect(app.title).toEqual('<%= name %>'); }); it('should render title', () => { const fixture = TestBed.createComponent(AppComponent); fixture.detectChanges(); - const compiled = fixture.debugElement.nativeElement; + const compiled = fixture.nativeElement; expect(compiled.querySelector('.content span').textContent).toContain('<%= name %> app is running!'); }); });