Skip to content

Commit

Permalink
fix(@schematics/angular): remove unsafe any usage in application spec…
Browse files Browse the repository at this point in the history
… file

The `nativeElement` property on a `TestBed` fixture is of type `any`. In one of the tests within a new application's spec file, the `nativeElement` is accessed but not cast to an appropriate type which results in potentially unsafe member access. The `nativeElement` is now cast as an `HTMLElement` and allows additional usage to be type checked.
  • Loading branch information
clydin committed Jul 7, 2021
1 parent 20fd33f commit 5b10d4f
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe('AppComponent', () => {
it('should render title', () => {
const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.nativeElement;
expect(compiled.querySelector('.content span').textContent).toContain('<%= name %> app is running!');
const compiled = fixture.nativeElement as HTMLElement;
expect(compiled.querySelector('.content span')?.textContent).toContain('<%= name %> app is running!');
});
});

0 comments on commit 5b10d4f

Please sign in to comment.