|
1 | 1 | /* tslint:disable:no-unused-variable */ |
2 | | - |
3 | | -import { TestBed, async } from '@angular/core/testing'; |
4 | | -import { AppComponent } from './app.component'; |
5 | | -import { AuthService } from './shared/auth.service'; |
6 | | -import { FormsModule } from '@angular/forms'; |
7 | | -import {AsyncSubject} from "rxjs"; |
| 2 | +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; |
| 3 | +import {TestBed, async} from "@angular/core/testing"; |
| 4 | +import {AppComponent} from "./app.component"; |
8 | 5 |
|
9 | 6 | describe('AppComponent', () => { |
10 | | - beforeEach(() => { |
11 | | - let authServiceStub = { |
12 | | - login: function () { return true }, |
13 | | - logout: function () { return true }, |
14 | | - isLoggedIn: function () { |
15 | | - return new AsyncSubject<boolean>(); |
16 | | - } |
17 | | - }; |
18 | | - |
19 | | - TestBed.configureTestingModule({ |
20 | | - imports: [ FormsModule ], |
21 | | - declarations: [ |
22 | | - AppComponent |
23 | | - ], |
24 | | - providers: [ |
25 | | - { provide: AuthService, useValue: authServiceStub } |
26 | | - ] |
| 7 | + beforeEach(() => { |
| 8 | + TestBed.configureTestingModule({ |
| 9 | + declarations: [ |
| 10 | + AppComponent |
| 11 | + ], |
| 12 | + schemas: [CUSTOM_ELEMENTS_SCHEMA] |
| 13 | + }); |
27 | 14 | }); |
28 | | - }); |
29 | 15 |
|
30 | | - it('should create the app', async(() => { |
31 | | - let fixture = TestBed.createComponent(AppComponent); |
32 | | - let app = fixture.debugElement.componentInstance; |
33 | | - expect(app).toBeTruthy(); |
34 | | - })); |
| 16 | + it('should create the app', async(() => { |
| 17 | + let fixture = TestBed.createComponent(AppComponent); |
| 18 | + let app = fixture.debugElement.componentInstance; |
| 19 | + expect(app).toBeTruthy(); |
| 20 | + })); |
35 | 21 |
|
36 | | - it(`should have as title 'app works!'`, async(() => { |
37 | | - let fixture = TestBed.createComponent(AppComponent); |
38 | | - let app = fixture.debugElement.componentInstance; |
39 | | - expect(app.title).toEqual('app works! - <%= name %>'); |
40 | | - })); |
| 22 | + it(`should have as title 'app works!'`, async(() => { |
| 23 | + let fixture = TestBed.createComponent(AppComponent); |
| 24 | + let app = fixture.debugElement.componentInstance; |
| 25 | + expect(app.title).toEqual('app works! - <%= name %>'); |
| 26 | + })); |
41 | 27 |
|
42 | | - it('should render title in a h1 tag', async(() => { |
43 | | - let fixture = TestBed.createComponent(AppComponent); |
44 | | - fixture.detectChanges(); |
45 | | - let compiled = fixture.debugElement.nativeElement; |
46 | | - expect(compiled.querySelector('h1').textContent).toContain('app works! - <%= name %>'); |
47 | | - })); |
| 28 | + it('should render title in a h1 tag', async(() => { |
| 29 | + let fixture = TestBed.createComponent(AppComponent); |
| 30 | + fixture.detectChanges(); |
| 31 | + let compiled = fixture.debugElement.nativeElement; |
| 32 | + expect(compiled.querySelector('h1').textContent).toContain('app works! - <%= name %>'); |
| 33 | + })); |
48 | 34 | }); |
0 commit comments