Sean Condon | 87b7850 | 2018-09-17 20:53:24 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2018-present Open Networking Foundation |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | import { TestBed, async } from '@angular/core/testing'; |
| 18 | import { AppComponent } from './app.component'; |
| 19 | describe('AppComponent', () => { |
| 20 | beforeEach(async(() => { |
| 21 | TestBed.configureTestingModule({ |
| 22 | declarations: [ |
| 23 | AppComponent |
| 24 | ], |
| 25 | }).compileComponents(); |
| 26 | })); |
| 27 | it('should create the app', async(() => { |
| 28 | const fixture = TestBed.createComponent(AppComponent); |
| 29 | const app = fixture.debugElement.componentInstance; |
| 30 | expect(app).toBeTruthy(); |
| 31 | })); |
| 32 | it(`should have as title 'app'`, async(() => { |
| 33 | const fixture = TestBed.createComponent(AppComponent); |
| 34 | const app = fixture.debugElement.componentInstance; |
| 35 | expect(app.title).toEqual('app'); |
| 36 | })); |
| 37 | it('should render title in a h1 tag', async(() => { |
| 38 | const fixture = TestBed.createComponent(AppComponent); |
| 39 | fixture.detectChanges(); |
| 40 | const compiled = fixture.debugElement.nativeElement; |
| 41 | expect(compiled.querySelector('h1').textContent).toContain('Welcome to app!'); |
| 42 | })); |
| 43 | }); |