portfolio/src/app/home/home.component.spec.ts
2024-05-12 01:25:15 -07:00

30 lines
797 B
TypeScript

import { ComponentFixture, TestBed } from "@angular/core/testing";
import { HomeComponent } from "./home.component";
describe("HomeComponent", () => {
let component: HomeComponent;
let fixture: ComponentFixture<HomeComponent>;
let compiled: HTMLElement;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [HomeComponent]
}).compileComponents();
fixture = TestBed.createComponent(HomeComponent);
component = fixture.componentInstance;
fixture.detectChanges();
compiled = fixture.nativeElement;
});
it("should create", () => {
expect(component).toBeTruthy();
});
it("should render correctly", () => {
const header = compiled.querySelector("h1");
expect(header?.innerText.trim()).toBe("Naomi Carrigan");
});
});