blob: 9f71c8f8b73858dd94514020bcf7229618b486ed [file] [log] [blame]
Skip Wonnell2c977e22018-03-01 08:30:15 -06001/*
2============LICENSE_START==========================================
3===================================================================
4Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
5===================================================================
6
7Unless otherwise specified, all software contained herein is licensed
8under the Apache License, Version 2.0 (the License);
9you may not use this software except in compliance with the License.
10You may obtain a copy of the License at
11
12 http://www.apache.org/licenses/LICENSE-2.0
13
14Unless required by applicable law or agreed to in writing, software
15distributed under the License is distributed on an "AS IS" BASIS,
16WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17See the License for the specific language governing permissions and
18limitations under the License.
19
Skip Wonnell2c977e22018-03-01 08:30:15 -060020============LICENSE_END============================================
21*/
sj108sf27d5542018-04-02 14:46:25 +053022
sj108sf1e61ce2018-03-13 20:29:58 +053023import { async, ComponentFixture, TestBed, inject, tick, fakeAsync } from '@angular/core/testing';
24import { Http, HttpModule, ConnectionBackend, BaseRequestOptions, Response, ResponseOptions } from '@angular/http';
25import { MockBackend } from '@angular/http/testing';
26import { ModalDismissReasons, NgbModule } from '@ng-bootstrap/ng-bootstrap';
27import { Observable } from 'rxjs/Observable';
28import 'rxjs/add/observable/from';
29import 'rxjs/add/observable/empty';
30import 'rxjs/add/observable/of';
Skip Wonnell2c977e22018-03-01 08:30:15 -060031
sj108sf1e61ce2018-03-13 20:29:58 +053032import { AboutUsComponent } from './aboutus.component';
Skip Wonnell2c977e22018-03-01 08:30:15 -060033
sj108sf1e61ce2018-03-13 20:29:58 +053034class MockService {
35 doStuff() {
36 return this;
37 }
38}
Skip Wonnell2c977e22018-03-01 08:30:15 -060039
40describe('ContacUsComponent', () => {
41 let component: AboutUsComponent;
42 let fixture: ComponentFixture<AboutUsComponent>;
sj108sf1e61ce2018-03-13 20:29:58 +053043
Skip Wonnell2c977e22018-03-01 08:30:15 -060044 beforeEach(async(() => {
sj108sf1e61ce2018-03-13 20:29:58 +053045 let http = new MockService();
46
Skip Wonnell2c977e22018-03-01 08:30:15 -060047 TestBed.configureTestingModule({
sj108sf1e61ce2018-03-13 20:29:58 +053048 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}]
sj108sf27d5542018-04-02 14:46:25 +053058 }).compileComponents();
Skip Wonnell2c977e22018-03-01 08:30:15 -060059 }));
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 });
sj108sf1e61ce2018-03-13 20:29:58 +053070
sj108sf1e61ce2018-03-13 20:29:58 +053071 it('should open modal', inject([NgbModule],(ngbModule: NgbModule) => {
sj108sf27d5542018-04-02 14:46:25 +053072 let content = 'test';
73 component.open(content);
sj108sf1e61ce2018-03-13 20:29:58 +053074 }));
75
76 it('should download log file', () => {
77 var blob = new Blob(['test'], {
78 type: 'text/plain;charset=utf-8'
79 });
sj108sf1e61ce2018-03-13 20:29:58 +053080 component.downloadLogFile();
81 });
Skip Wonnell2c977e22018-03-01 08:30:15 -060082});