vcell / data /webapp-ng /src /app /components /hero /hero.component.spec.ts
introvoyz041's picture
Migrated from GitHub
9d54b72 verified
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { HeroComponent } from './hero.component';
describe('HeroComponent', () => {
let component: HeroComponent;
let fixture: ComponentFixture<HeroComponent>;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [HeroComponent],
}).compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(HeroComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
it('should render title in a h1 tag', () => {
fixture.detectChanges();
const compiled = fixture.debugElement.nativeElement;
expect(compiled.querySelector('h1').textContent).toContain(
'Angular Sample Project'
);
});
});