app.spec.ts 708 B

1234567891011121314151617181920212223
  1. import { TestBed } from '@angular/core/testing';
  2. import { AppComponent } from './app';
  3. describe('App', () => {
  4. beforeEach(async () => {
  5. await TestBed.configureTestingModule({
  6. imports: [AppComponent],
  7. }).compileComponents();
  8. });
  9. it('should create the app', () => {
  10. const fixture = TestBed.createComponent(AppComponent);
  11. const app = fixture.componentInstance;
  12. expect(app).toBeTruthy();
  13. });
  14. it('should render title', () => {
  15. const fixture = TestBed.createComponent(AppComponent);
  16. fixture.detectChanges();
  17. const compiled = fixture.nativeElement as HTMLElement;
  18. expect(compiled.querySelector('h1')?.textContent).toContain('Hello, my-angular-app');
  19. });
  20. });