app.component.spec.ts 997 B

1234567891011121314151617181920212223242526272829
  1. import { TestBed } from '@angular/core/testing';
  2. import { RouterTestingModule } from '@angular/router/testing';
  3. import { AppComponent } from './app.component';
  4. describe('AppComponent', () => {
  5. beforeEach(() => TestBed.configureTestingModule({
  6. imports: [RouterTestingModule],
  7. declarations: [AppComponent]
  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 have as title 'DnDTools'`, () => {
  15. const fixture = TestBed.createComponent(AppComponent);
  16. const app = fixture.componentInstance;
  17. expect(app.title).toEqual('DnDTools');
  18. });
  19. it('should render title', () => {
  20. const fixture = TestBed.createComponent(AppComponent);
  21. fixture.detectChanges();
  22. const compiled = fixture.nativeElement as HTMLElement;
  23. expect(compiled.querySelector('.content span')?.textContent).toContain('DnDTools app is running!');
  24. });
  25. });