blob: 91b3f1a2da2c8f373ec709a7bf893b654b5bd3ae [file] [log] [blame]
Matteo Scandolod819c922016-12-02 14:06:14 -08001/// <reference path="../../typings/index.d.ts"/>
2
3import {HelloComponent} from './hello';
4import {TestBed, async} from '@angular/core/testing';
Matteo Scandolo43ffb672016-12-02 14:49:58 -08005import {StyleConfig} from './config/style.config';
6import { Http, BaseRequestOptions } from '@angular/http';
7import { MockBackend } from '@angular/http/testing';
Matteo Scandolod819c922016-12-02 14:06:14 -08008
9describe('hello component', () => {
10 beforeEach(async(() => {
11 TestBed.configureTestingModule({
12 declarations: [
13 HelloComponent
Matteo Scandolo43ffb672016-12-02 14:49:58 -080014 ],
15 providers: [
16 {
17 provide: Http,
18 useFactory: (mockBackend, options) => {
19 return new Http(mockBackend, options);
20 },
21 deps: [MockBackend, BaseRequestOptions]
22 },
23 MockBackend,
24 BaseRequestOptions
Matteo Scandolod819c922016-12-02 14:06:14 -080025 ]
26 });
27 TestBed.compileComponents();
28 }));
29
30 it('should render hello world', () => {
31 const fixture = TestBed.createComponent(HelloComponent);
32 fixture.detectChanges();
33 const hello = fixture.nativeElement;
Matteo Scandolo43ffb672016-12-02 14:49:58 -080034 expect(hello.querySelector('h1').textContent).toBe(`Hello ${StyleConfig.projectName}!`);
Matteo Scandolod819c922016-12-02 14:06:14 -080035 });
36});