36 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
			
		
		
	
	
			36 lines
		
	
	
		
			1.0 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
/* tslint:disable:no-unused-variable */
 | 
						|
import { AppComponent } from './app.component';
 | 
						|
 | 
						|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
 | 
						|
import { By }           from '@angular/platform-browser';
 | 
						|
import { DebugElement } from '@angular/core';
 | 
						|
 | 
						|
////////  SPECS  /////////////
 | 
						|
describe('AppComponent', function () {
 | 
						|
  let de: DebugElement;
 | 
						|
  let comp: AppComponent;
 | 
						|
  let fixture: ComponentFixture<AppComponent>;
 | 
						|
 | 
						|
  beforeEach(async(() => {
 | 
						|
   TestBed.configureTestingModule({
 | 
						|
      declarations: [ AppComponent ]
 | 
						|
    })
 | 
						|
    .compileComponents();
 | 
						|
  }));
 | 
						|
 | 
						|
  beforeEach(() => {
 | 
						|
    fixture = TestBed.createComponent(AppComponent);
 | 
						|
    comp = fixture.componentInstance;
 | 
						|
    de = fixture.debugElement.query(By.css('h1'));
 | 
						|
  });
 | 
						|
 | 
						|
  it('should create component', () => expect(comp).toBeDefined() );
 | 
						|
 | 
						|
  it('should have expected <h1> text', () => {
 | 
						|
    fixture.detectChanges();
 | 
						|
    const h1 = de.nativeElement;
 | 
						|
    expect(h1.innerText).toMatch(/angular/i,
 | 
						|
      '<h1> should say something about "Angular"');
 | 
						|
  });
 | 
						|
});
 |