import{TestBed,async}from'@angular/core/testing';import{RouterTestingModule}from'@angular/router/testing';import{AppComponent}from'./app.component';describe('AppComponent',()=>{beforeEach(async(()=>{TestBed.configureTestingModule({imports:[RouterTestingModule],declarations:[AppComponent],}).compileComponents();}));it('should create the app',()=>{constfixture=TestBed.createComponent(AppComponent);constapp=fixture.debugElement.componentInstance;expect(app).toBeTruthy();});it(`should have as title 'P2'`,()=>{constfixture=TestBed.createComponent(AppComponent);constapp=fixture.debugElement.componentInstance;expect(app.title).toEqual('P2');});it('should render title in a h1 tag',()=>{constfixture=TestBed.createComponent(AppComponent);fixture.detectChanges();constcompiled=fixture.debugElement.nativeElement;expect(compiled.querySelector('h1').textContent).toContain('Welcome to P2!');});});