Skip Wonnell | 2c977e2 | 2018-03-01 08:30:15 -0600 | [diff] [blame] | 1 | /* |
| 2 | ============LICENSE_START========================================== |
| 3 | =================================================================== |
| 4 | Copyright (C) 2018 AT&T Intellectual Property. All rights reserved. |
| 5 | =================================================================== |
| 6 | |
| 7 | Unless otherwise specified, all software contained herein is licensed |
| 8 | under the Apache License, Version 2.0 (the License); |
| 9 | you may not use this software except in compliance with the License. |
| 10 | You may obtain a copy of the License at |
| 11 | |
| 12 | http://www.apache.org/licenses/LICENSE-2.0 |
| 13 | |
| 14 | Unless required by applicable law or agreed to in writing, software |
| 15 | distributed under the License is distributed on an "AS IS" BASIS, |
| 16 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 17 | See the License for the specific language governing permissions and |
| 18 | limitations under the License. |
| 19 | |
Skip Wonnell | 2c977e2 | 2018-03-01 08:30:15 -0600 | [diff] [blame] | 20 | ============LICENSE_END============================================ |
| 21 | */ |
sj108s | f27d554 | 2018-04-02 14:46:25 +0530 | [diff] [blame^] | 22 | |
sj108s | f1e61ce | 2018-03-13 20:29:58 +0530 | [diff] [blame] | 23 | import { async, ComponentFixture, TestBed, inject, tick, fakeAsync } from '@angular/core/testing'; |
| 24 | import { Http, HttpModule, ConnectionBackend, BaseRequestOptions, Response, ResponseOptions } from '@angular/http'; |
| 25 | import { MockBackend } from '@angular/http/testing'; |
| 26 | import { ModalDismissReasons, NgbModule } from '@ng-bootstrap/ng-bootstrap'; |
| 27 | import { Observable } from 'rxjs/Observable'; |
| 28 | import 'rxjs/add/observable/from'; |
| 29 | import 'rxjs/add/observable/empty'; |
| 30 | import 'rxjs/add/observable/of'; |
Skip Wonnell | 2c977e2 | 2018-03-01 08:30:15 -0600 | [diff] [blame] | 31 | |
sj108s | f1e61ce | 2018-03-13 20:29:58 +0530 | [diff] [blame] | 32 | import { AboutUsComponent } from './aboutus.component'; |
Skip Wonnell | 2c977e2 | 2018-03-01 08:30:15 -0600 | [diff] [blame] | 33 | |
sj108s | f1e61ce | 2018-03-13 20:29:58 +0530 | [diff] [blame] | 34 | class MockService { |
| 35 | doStuff() { |
| 36 | return this; |
| 37 | } |
| 38 | } |
Skip Wonnell | 2c977e2 | 2018-03-01 08:30:15 -0600 | [diff] [blame] | 39 | |
| 40 | describe('ContacUsComponent', () => { |
| 41 | let component: AboutUsComponent; |
| 42 | let fixture: ComponentFixture<AboutUsComponent>; |
sj108s | f1e61ce | 2018-03-13 20:29:58 +0530 | [diff] [blame] | 43 | |
Skip Wonnell | 2c977e2 | 2018-03-01 08:30:15 -0600 | [diff] [blame] | 44 | beforeEach(async(() => { |
sj108s | f1e61ce | 2018-03-13 20:29:58 +0530 | [diff] [blame] | 45 | let http = new MockService(); |
| 46 | |
Skip Wonnell | 2c977e2 | 2018-03-01 08:30:15 -0600 | [diff] [blame] | 47 | TestBed.configureTestingModule({ |
sj108s | f1e61ce | 2018-03-13 20:29:58 +0530 | [diff] [blame] | 48 | declarations: [AboutUsComponent], |
| 49 | imports: [HttpModule, NgbModule.forRoot()], |
| 50 | providers: [NgbModule, { |
| 51 | provide: Http, useFactory: (backend: ConnectionBackend, defaultOptions: BaseRequestOptions) => { |
| 52 | return new Http(backend, defaultOptions); |
| 53 | }, deps: [MockBackend, BaseRequestOptions] |
| 54 | }, |
| 55 | { provide: MockBackend, useClass: MockBackend }, |
| 56 | { provide: BaseRequestOptions, useClass: BaseRequestOptions }, |
| 57 | {provide: Http, useValue: http}] |
sj108s | f27d554 | 2018-04-02 14:46:25 +0530 | [diff] [blame^] | 58 | }).compileComponents(); |
Skip Wonnell | 2c977e2 | 2018-03-01 08:30:15 -0600 | [diff] [blame] | 59 | })); |
| 60 | |
| 61 | beforeEach(() => { |
| 62 | fixture = TestBed.createComponent(AboutUsComponent); |
| 63 | component = fixture.componentInstance; |
| 64 | fixture.detectChanges(); |
| 65 | }); |
| 66 | |
| 67 | it('should create', () => { |
| 68 | expect(component).toBeTruthy(); |
| 69 | }); |
sj108s | f1e61ce | 2018-03-13 20:29:58 +0530 | [diff] [blame] | 70 | |
sj108s | f1e61ce | 2018-03-13 20:29:58 +0530 | [diff] [blame] | 71 | it('should open modal', inject([NgbModule],(ngbModule: NgbModule) => { |
sj108s | f27d554 | 2018-04-02 14:46:25 +0530 | [diff] [blame^] | 72 | let content = 'test'; |
| 73 | component.open(content); |
sj108s | f1e61ce | 2018-03-13 20:29:58 +0530 | [diff] [blame] | 74 | })); |
| 75 | |
| 76 | it('should download log file', () => { |
| 77 | var blob = new Blob(['test'], { |
| 78 | type: 'text/plain;charset=utf-8' |
| 79 | }); |
sj108s | f1e61ce | 2018-03-13 20:29:58 +0530 | [diff] [blame] | 80 | component.downloadLogFile(); |
| 81 | }); |
Skip Wonnell | 2c977e2 | 2018-03-01 08:30:15 -0600 | [diff] [blame] | 82 | }); |