0% found this document useful (0 votes)
5 views1 page

Ponent Spec

The document is a test suite for the AppComponent in an Angular application using TestBed. It includes three tests: one to check if the component is created, another to verify the title property, and a third to ensure the title is rendered correctly in the template. The tests utilize RouterTestingModule and expect specific outcomes for the component's functionality.

Uploaded by

firojislamics
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views1 page

Ponent Spec

The document is a test suite for the AppComponent in an Angular application using TestBed. It includes three tests: one to check if the component is created, another to verify the title property, and a third to ensure the title is rendered correctly in the template. The tests utilize RouterTestingModule and expect specific outcomes for the component's functionality.

Uploaded by

firojislamics
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

import { TestBed } from '@angular/core/testing';

import { RouterTestingModule } from '@angular/router/testing';


import { AppComponent } from './app.component';

describe('AppComponent', () => {
beforeEach(() => TestBed.configureTestingModule({
imports: [RouterTestingModule],
declarations: [AppComponent]
}));

it('should create the app', () => {


const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app).toBeTruthy();
});

it(`should have as title 'demo'`, () => {


const fixture = TestBed.createComponent(AppComponent);
const app = fixture.componentInstance;
expect(app.title).toEqual('demo');
});

it('should render title', () => {


const fixture = TestBed.createComponent(AppComponent);
fixture.detectChanges();
const compiled = fixture.nativeElement as HTMLElement;
expect(compiled.querySelector('.content span')?.textContent).toContain('demo
app is running!');
});
});

You might also like