Fixed error 77/57177/2
authorArundathi Patil <arundpil@in.ibm.com>
Mon, 23 Jul 2018 14:40:06 +0000 (20:10 +0530)
committerTakamune Cho <tc012c@att.com>
Tue, 24 Jul 2018 14:51:00 +0000 (14:51 +0000)
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 <arundpil@in.ibm.com>
src/app/vnfs/build-artifacts/template-holder/param-name-value/param-name-value.component.spec.ts

index b9ac40f..705f430 100644 (file)
@@ -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