undefined.component.spec.ts 1.1 KB

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