From a6dbf8ac1f0e907d3a6b8f4d5bdd6a4217a057fb Mon Sep 17 00:00:00 2001 From: Arundathi Patil Date: Mon, 23 Jul 2018 20:10:06 +0530 Subject: Fixed error Test cases in param-name-value component spec file failed with the below error, Error: No provider for NgxSpinnerService Fixed this error Issue-ID: APPC-1064 Change-Id: Ib4e0b3276525973fb6a625d2366ed26cf3d94173 Signed-off-by: Arundathi Patil --- .../param-name-value.component.spec.ts | 35 +++++++++++----------- 1 file changed, 18 insertions(+), 17 deletions(-) (limited to 'src/app/vnfs/build-artifacts/template-holder/param-name-value/param-name-value.component.spec.ts') diff --git a/src/app/vnfs/build-artifacts/template-holder/param-name-value/param-name-value.component.spec.ts b/src/app/vnfs/build-artifacts/template-holder/param-name-value/param-name-value.component.spec.ts index b9ac40f..705f430 100644 --- a/src/app/vnfs/build-artifacts/template-holder/param-name-value/param-name-value.component.spec.ts +++ b/src/app/vnfs/build-artifacts/template-holder/param-name-value/param-name-value.component.spec.ts @@ -57,6 +57,7 @@ import { Observable } from 'rxjs/Observable'; import { NgProgress } from 'ngx-progressbar'; import { BaseRequestOptions, Response, ResponseOptions, Http } from '@angular/http'; import { MockBackend, MockConnection } from '@angular/http/testing'; +import { NgxSpinnerService } from 'ngx-spinner'; describe('GoldenConfigurationMappingComponent', () => { @@ -102,8 +103,8 @@ describe('GoldenConfigurationMappingComponent', () => { TestBed.configureTestingModule({ imports: [FormsModule, BrowserModule, RouterTestingModule.withRoutes(routes), HttpModule, Ng2Bs3ModalModule, SimpleNotificationsModule.forRoot()], declarations: [GoldenConfigurationMappingComponent, HomeComponent, TestComponent, HelpComponent, AboutUsComponent, LogoutComponent, AceEditorComponent], - providers: [BuildDesignComponent, NgProgress, ParamShareService, DialogService, NotificationService,MockBackend, - HttpUtilService, MappingEditorService, NotificationsService, + providers: [BuildDesignComponent, NgProgress, ParamShareService, DialogService, NotificationService, MockBackend, + HttpUtilService, MappingEditorService, NotificationsService, NgxSpinnerService, BaseRequestOptions, { provide: Http, @@ -225,7 +226,7 @@ describe('GoldenConfigurationMappingComponent', () => { component.vnfType = "testVnf"; component.userId = "abc"; component.item.action = "Configure"; - mappingEditorService.identifier="id1"; + mappingEditorService.identifier = "id1"; component.retrieveNameValueFromAppc(); expect(localStorage["localStorage['paramsContent']"]).not.toBe(null); @@ -245,46 +246,46 @@ describe('GoldenConfigurationMappingComponent', () => { // fileChange method it('Should validatte fileChange method if file type is json', async(() => { let reader = new FileReader(); - let obj = {"e": " "}; + let obj = { "e": " " }; let data = JSON.stringify(obj); - let file = new File([data], "foo.json", {type: "text/json"}); - let input = {files: [file]}; + let file = new File([data], "foo.json", { type: "text/json" }); + let input = { files: [file] }; component.fileParamChange(input); - component.readFile(input.files[0], reader,(res) => { + component.readFile(input.files[0], reader, (res) => { let jsonObject = JSON.parse(res); expect(component.selectedUploadType).toEqual('Mapping Data'); expect(component.artifactRequest.paramsContent).toEqual(JSON.stringify(jsonObject, null, 1)); - }); + }); })); it('Should validatte fileChange method if file type is not json', () => { let spy = spyOn(NotificationsService.prototype, 'error'); - let file = new File(["testing"], "foo.txt", {type: "text/txt"}); - let input = {files: [file]}; + let file = new File(["testing"], "foo.txt", { type: "text/txt" }); + let input = { files: [file] }; component.fileParamChange(input); - expect(spy).toHaveBeenCalled(); + expect(spy).toHaveBeenCalled(); }); it('Should validatte fileChange method if file is false', () => { let spy = spyOn(NotificationsService.prototype, 'error'); - let input = {files: []}; + let input = { files: [] }; component.fileParamChange(input); - expect(spy).toHaveBeenCalled(); + expect(spy).toHaveBeenCalled(); }); - it('should validate of the file name creation for configscaleout is correct', () => { + it('should validate of the file name creation for configscaleout is correct', () => { fixture = TestBed.createComponent(GoldenConfigurationMappingComponent); component = fixture.componentInstance; - let fileName=component.updateFileNameForConfigScaleOut('Configure','testVnfType','0.0.1','id1'); - let expectedFileName="param_ Configure_testVnfType_0.0.1V_id1.json" - expect(expectedFileName).toBe(fileName); + let fileName = component.updateFileNameForConfigScaleOut('Configure', 'testVnfType', '0.0.1', 'id1'); + let expectedFileName = "param_ Configure_testVnfType_0.0.1V_id1.json" + expect(expectedFileName).toBe(fileName); }); }); \ No newline at end of file -- cgit 1.2.3-korg