2 ============LICENSE_START==========================================
3 ===================================================================
4 Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
6 Modification Copyright (C) 2018 IBM.
7 ===================================================================
9 Unless otherwise specified, all software contained herein is licensed
10 under the Apache License, Version 2.0 (the License);
11 you may not use this software except in compliance with the License.
12 You may obtain a copy of the License at
14 http://www.apache.org/licenses/LICENSE-2.0
16 Unless required by applicable law or agreed to in writing, software
17 distributed under the License is distributed on an "AS IS" BASIS,
18 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 See the License for the specific language governing permissions and
20 limitations under the License.
22 ============LICENSE_END============================================
25 import { async, ComponentFixture, TestBed, inject, tick, fakeAsync } from '@angular/core/testing';
26 import { Http, HttpModule, ConnectionBackend, BaseRequestOptions, Response, ResponseOptions } from '@angular/http';
27 import { MockBackend } from '@angular/http/testing';
28 import { ModalDismissReasons, NgbModule, NgbModal } from '@ng-bootstrap/ng-bootstrap';
29 import { Observable } from 'rxjs/Observable';
30 import 'rxjs/add/observable/from';
31 import 'rxjs/add/observable/empty';
32 import 'rxjs/add/observable/of';
33 import { SimpleNotificationsModule, NotificationsService } from 'angular2-notifications';
34 import { DialogService } from 'ng2-bootstrap-modal';
36 import { AboutUsComponent } from './aboutus.component';
43 return Observable.of(new Response(
51 describe('ContacUsComponent', () => {
52 let component: AboutUsComponent;
53 let fixture: ComponentFixture<AboutUsComponent>;
55 beforeEach(async(() => {
56 let http = new MockService();
58 TestBed.configureTestingModule({
59 declarations: [AboutUsComponent],
60 imports: [HttpModule, NgbModule.forRoot(), SimpleNotificationsModule.forRoot()],
61 providers: [NgbModule, DialogService, {
62 provide: Http, useFactory: (backend: ConnectionBackend, defaultOptions: BaseRequestOptions) => {
63 return new Http(backend, defaultOptions);
64 }, deps: [MockBackend, BaseRequestOptions]
66 { provide: MockBackend, useClass: MockBackend },
67 { provide: BaseRequestOptions, useClass: BaseRequestOptions },
68 { provide: Http, useValue: http }]
69 }).compileComponents();
73 fixture = TestBed.createComponent(AboutUsComponent);
74 component = fixture.componentInstance;
75 fixture.detectChanges();
78 it('should create', () => {
79 expect(component).toBeTruthy();
82 it('should open modal', inject([NgbModule, Http], (ngbModule: NgbModule, http: Http) => {
84 // component.open(content);
85 component.versionLogFile().subscribe((data) => {
86 expect(data.text()).toBe('some data');
90 it('should download log file', () => {
91 var blob = new Blob(['test'], {
92 type: 'text/plain;charset=utf-8'
94 component.downloadLogFile();