2017-02-22 18:13:21 +00:00
|
|
|
import { AppComponent } from './app.component';
|
|
|
|
|
|
|
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
2020-03-23 17:31:55 +02:00
|
|
|
import { By } from '@angular/platform-browser';
|
2017-02-22 18:13:21 +00:00
|
|
|
import { DebugElement } from '@angular/core';
|
|
|
|
|
2020-03-23 17:31:55 +02:00
|
|
|
describe('AppComponent', () => {
|
2017-02-22 18:13:21 +00:00
|
|
|
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;
|
2017-06-18 12:29:48 +03:00
|
|
|
expect(h1.textContent).toMatch(/angular/i,
|
2017-02-22 18:13:21 +00:00
|
|
|
'<h1> should say something about "Angular"');
|
|
|
|
});
|
|
|
|
});
|