| /// <reference path="../../typings/index.d.ts"/> |
| |
| import {HelloComponent} from './hello'; |
| import {TestBed, async} from '@angular/core/testing'; |
| import {StyleConfig} from './config/style.config'; |
| import { Http, BaseRequestOptions } from '@angular/http'; |
| import { MockBackend } from '@angular/http/testing'; |
| |
| describe('hello component', () => { |
| beforeEach(async(() => { |
| TestBed.configureTestingModule({ |
| declarations: [ |
| HelloComponent |
| ], |
| providers: [ |
| { |
| provide: Http, |
| useFactory: (mockBackend, options) => { |
| return new Http(mockBackend, options); |
| }, |
| deps: [MockBackend, BaseRequestOptions] |
| }, |
| MockBackend, |
| BaseRequestOptions |
| ] |
| }); |
| TestBed.compileComponents(); |
| })); |
| |
| it('should render hello world', () => { |
| const fixture = TestBed.createComponent(HelloComponent); |
| fixture.detectChanges(); |
| const hello = fixture.nativeElement; |
| expect(hello.querySelector('h1').textContent).toBe(`Hello ${StyleConfig.projectName}!`); |
| }); |
| }); |