app.component.spec.ts 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. import { TestBed, async } from '@angular/core/testing';
  2. import { RouterTestingModule } from '@angular/router/testing';
  3. import { AppComponent } from './app.component';
  4. describe('AppComponent', () => {
  5. beforeEach(async(() => {
  6. TestBed.configureTestingModule({
  7. imports: [
  8. RouterTestingModule
  9. ],
  10. declarations: [
  11. AppComponent
  12. ],
  13. }).compileComponents();
  14. }));
  15. it('should create the app', () => {
  16. const fixture = TestBed.createComponent(AppComponent);
  17. const app = fixture.debugElement.componentInstance;
  18. expect(app).toBeTruthy();
  19. });
  20. it(`should have as title 'medical-project'`, () => {
  21. const fixture = TestBed.createComponent(AppComponent);
  22. const app = fixture.debugElement.componentInstance;
  23. expect(app.title).toEqual('medical-project');
  24. });
  25. it('should render title in a h1 tag', () => {
  26. const fixture = TestBed.createComponent(AppComponent);
  27. fixture.detectChanges();
  28. const compiled = fixture.debugElement.nativeElement;
  29. expect(compiled.querySelector('h1').textContent).toContain('Welcome to medical-project!');
  30. });
  31. });