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 | |
| 20 | ECOMP is a trademark and service mark of AT&T Intellectual Property. |
| 21 | ============LICENSE_END============================================ |
| 22 | */ |
| 23 | |
| 24 | /* tslint:disable:no-unused-variable */ |
| 25 | |
| 26 | // Modules |
| 27 | import { async, ComponentFixture, TestBed,inject } from '@angular/core/testing'; |
| 28 | import { By } from '@angular/platform-browser'; |
| 29 | import { DebugElement } from '@angular/core'; |
| 30 | import { FormsModule, ReactiveFormsModule } from '@angular/forms'; |
| 31 | import { RouterTestingModule } from '@angular/router/testing'; |
| 32 | import { SimpleNotificationsModule } from 'angular2-notifications'; |
| 33 | import { Http, Response, Headers, RequestOptions, HttpModule } from '@angular/http'; |
| 34 | |
| 35 | // Component |
| 36 | import { TestComponent } from './test.component'; |
| 37 | |
| 38 | // Services |
| 39 | import { NotificationService } from '../shared/services/notification.service'; |
| 40 | import { ParamShareService } from '.././shared/services/paramShare.service'; |
| 41 | import { MappingEditorService } from '../shared/services/mapping-editor.service'; |
| 42 | import { HttpUtilService } from '../shared/services/httpUtil/http-util.service'; |
| 43 | import { UtilityService } from '../shared/services/utilityService/utility.service'; |
| 44 | import { NgProgress } from 'ngx-progressbar'; |
| 45 | import {NgProgressModule} from 'ngx-progressbar'; |
| 46 | |
| 47 | describe( 'TestComponent', () => { |
| 48 | let component: TestComponent; |
| 49 | let fixture: ComponentFixture<TestComponent>; |
| 50 | |
| 51 | |
| 52 | beforeEach(async(() => { |
| 53 | TestBed.configureTestingModule({ |
| 54 | declarations: [TestComponent], |
| 55 | imports: [ |
| 56 | FormsModule, |
| 57 | RouterTestingModule, |
| 58 | SimpleNotificationsModule, |
| 59 | HttpModule, |
| 60 | NgProgressModule |
| 61 | ], |
| 62 | providers: [ |
| 63 | NotificationService, |
| 64 | ParamShareService, |
| 65 | MappingEditorService, |
| 66 | HttpUtilService, |
| 67 | UtilityService, |
| 68 | NgProgress |
| 69 | ] |
| 70 | }) |
| 71 | .compileComponents(); |
| 72 | })); |
| 73 | |
| 74 | beforeEach(() => { |
| 75 | fixture = TestBed.createComponent(TestComponent); |
| 76 | component = fixture.componentInstance; |
| 77 | fixture.detectChanges(); |
| 78 | }); |
| 79 | |
| 80 | it( 'should create', () => { |
| 81 | expect(component).toBeTruthy(); |
| 82 | }); |
| 83 | |
| 84 | // it('test', () => { |
| 85 | // expect(2).toEqual(1) |
| 86 | // }); |
| 87 | |
| 88 | |
| 89 | // it('test preparfilename', inject([MappingEditorService], (mappingEditorService: MappingEditorService) => { |
| 90 | // // fixture = TestBed.createComponent(TestComponent); |
| 91 | // // component = fixture.componentInstance; |
| 92 | // mappingEditorService.latestAction=undefined |
| 93 | |
| 94 | // expect(component.prepareFileName()).toBe(undefined); |
| 95 | // })); |
| 96 | |
| 97 | |
| 98 | it('Should have download method', () => { |
| 99 | expect(component.download).toBeDefined(); |
| 100 | }); |
| 101 | |
| 102 | // Test abortTest Method |
| 103 | it('Should have abortTest method', () => { |
| 104 | expect(component.abortTest).toBeDefined(); |
| 105 | }); |
| 106 | |
| 107 | it('Test abortTest Method', () => { |
| 108 | const temp = component.abortTest(); |
| 109 | expect(component.enableBrowse).toBeTruthy(); |
| 110 | expect(component.enableTestButton).toBeTruthy(); |
| 111 | }); |
| 112 | |
| 113 | it('Should have excelBrowseOption method', () => { |
| 114 | expect(component.excelBrowseOption).toBeDefined(); |
| 115 | }); |
| 116 | |
| 117 | it('Should have upload method', () => { |
| 118 | expect(component.upload).toBeDefined(); |
| 119 | }); |
| 120 | |
| 121 | it('Should have constructTestPayload method', () => { |
| 122 | expect(component.constructTestPayload).toBeDefined(); |
| 123 | }); |
| 124 | |
| 125 | it('Should have constructRequest method', () => { |
| 126 | expect(component.constructRequest).toBeDefined(); |
| 127 | }); |
| 128 | |
| 129 | it('Should have testVnf method', () => { |
| 130 | expect(component.testVnf).toBeDefined(); |
| 131 | }); |
| 132 | |
| 133 | it('Should have pollTestStatus method', () => { |
| 134 | expect(component.pollTestStatus).toBeDefined(); |
| 135 | }); |
| 136 | |
| 137 | |
| 138 | // Test getUrlEndPoint Method |
| 139 | it('Should have getUrlEndPoint method', () => { |
| 140 | expect(component.getUrlEndPoint).toBeDefined(); |
| 141 | }); |
| 142 | |
| 143 | it('getUrlEndPoint Should return value', () => { |
| 144 | expect(component.getUrlEndPoint('configmodify')).toEqual('config-modify'); |
| 145 | expect(component.getUrlEndPoint('configbackup')).toEqual('config-backup'); |
| 146 | expect(component.getUrlEndPoint('configrestore')).toEqual('config-restore'); |
| 147 | expect(component.getUrlEndPoint('healthcheck')).toEqual('health-check'); |
| 148 | expect(component.getUrlEndPoint('quiescetraffic')).toEqual('quiesce-traffic'); |
| 149 | expect(component.getUrlEndPoint('resumetraffic')).toEqual('resume-traffic'); |
| 150 | expect(component.getUrlEndPoint('startapplication')).toEqual('start-application'); |
| 151 | expect(component.getUrlEndPoint('stopapplication')).toEqual('stop-application'); |
| 152 | expect(component.getUrlEndPoint('upgradebackout')).toEqual('upgrade-backout'); |
| 153 | expect(component.getUrlEndPoint('upgradepostcheck')).toEqual('upgrade-post-check'); |
| 154 | expect(component.getUrlEndPoint('upgradeprecheck')).toEqual('upgrade-pre-check'); |
| 155 | expect(component.getUrlEndPoint('upgradesoftware')).toEqual('upgrade-software'); |
| 156 | expect(component.getUrlEndPoint('DeFaultCASE')).toEqual('defaultcase'); |
| 157 | }); |
| 158 | }) |