diff options
author | jegadeeshbabu3 <jegadeesh.babu@att.com> | 2020-03-16 20:49:49 +0530 |
---|---|---|
committer | jegadeeshbabu3 <jegadeesh.babu@att.com> | 2020-03-16 20:50:25 +0530 |
commit | c953ac7f8c9a6ece47ba4b7195f8b9148944a45b (patch) | |
tree | a49ce80defc099ecd8de220b4e436a30d17f3cc6 | |
parent | d7c3aae80ea1c8c9af4d7981bb77b68be7974427 (diff) |
Fixed sonar version related issue
Fixed sonar latest version realted issue
Issue-ID: PORTAL-837
Change-Id: I8b82f083c5449032706c88e46782572467f075a3
Signed-off-by: jz385p <jegadeesh.babu@att.com>
-rw-r--r-- | portal-FE-common/src/app/pages/widget-onboarding/widget-onboarding.component.spec.ts | 51 | ||||
-rw-r--r-- | portal-FE-os/pom.xml | 2 |
2 files changed, 52 insertions, 1 deletions
diff --git a/portal-FE-common/src/app/pages/widget-onboarding/widget-onboarding.component.spec.ts b/portal-FE-common/src/app/pages/widget-onboarding/widget-onboarding.component.spec.ts index e0df154d..1ecba2c2 100644 --- a/portal-FE-common/src/app/pages/widget-onboarding/widget-onboarding.component.spec.ts +++ b/portal-FE-common/src/app/pages/widget-onboarding/widget-onboarding.component.spec.ts @@ -42,17 +42,59 @@ import { HttpClientTestingModule } from '@angular/common/http/testing'; import { FormsModule } from '@angular/forms'; import { NgMaterialModule } from 'src/app/ng-material-module'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; +import { WidgetOnboardingService } from 'src/app/shared/services/widget-onboarding/widget-onboarding.service'; +import { Observable } from 'rxjs'; +import { HttpClientModule } from '@angular/common/http'; describe('WidgetOnboardingComponent', () => { let component: WidgetOnboardingComponent; let fixture: ComponentFixture<WidgetOnboardingComponent>; + let widgetList = [{"id" :"1", + "name":"ONAP-A", + "desc" :"desc", + "fileLocation" : "fileLocation", + "allowAllUser" : "allowAllUser", + "serviceId" : "serviceId", + "serviceURL" : "serviceURL", + "sortOrder" : "sortOrder", + "statusCode" : "statusCode", + "widgetRoles": "widgetRoles", + "appContent" : "appContent", + "appName" : "appName", + "file" : "file", + "allUser": false, + "saving": "saving"},{"id" :"1", + "name":"ONAP-B", + "desc" :"desc", + "fileLocation" : "fileLocation", + "allowAllUser" : "allowAllUser", + "serviceId" : "serviceId", + "serviceURL" : "serviceURL", + "sortOrder" : "sortOrder", + "statusCode" : "statusCode", + "widgetRoles": "widgetRoles", + "appContent" : "appContent", + "appName" : "appName", + "file" : "file", + "allUser": false, + "saving": "saving"}] + beforeEach(async(() => { + let widgetOnboardingService: WidgetOnboardingService; + + // widgetOnboardingService = jasmine.createSpyObj('WidgetOnboardingService', ['getManagedWidgets']); + //widgetOnboardingService.getManagedWidgets.and.returnValue(Observable.of(widgetList)); TestBed.configureTestingModule({ declarations: [ WidgetOnboardingComponent ], - imports:[HttpClientTestingModule,FormsModule,NgMaterialModule,BrowserAnimationsModule], + imports:[HttpClientModule,FormsModule,NgMaterialModule,BrowserAnimationsModule], + providers:[WidgetOnboardingService] }) .compileComponents(); + + + widgetOnboardingService = TestBed.get(WidgetOnboardingService); + spyOn(widgetOnboardingService, 'getManagedWidgets').and.returnValue(Observable.of(widgetList)); })); beforeEach(() => { @@ -61,7 +103,14 @@ describe('WidgetOnboardingComponent', () => { fixture.detectChanges(); }); + + it('should create', () => { expect(component).toBeTruthy(); }); + it('getOnboardingWidgets should return stubbed value', () => { + spyOn(component, 'getOnboardingWidgets').and.callThrough(); + component.getOnboardingWidgets(); + expect(component.getOnboardingWidgets).toHaveBeenCalledWith(); + }); }); diff --git a/portal-FE-os/pom.xml b/portal-FE-os/pom.xml index 57507bfb..85def902 100644 --- a/portal-FE-os/pom.xml +++ b/portal-FE-os/pom.xml @@ -17,7 +17,9 @@ <sonar.exclusions>**/node_modules/**,**/*.spec.ts,**/*.module.ts,**/environment.prod.ts,**/*.js,**/main.ts,**/header-interceptor.ts,**/dynamic-widget.component.ts</sonar.exclusions> <sonar.test.inclusions>**/*.spec.ts</sonar.test.inclusions> <sonar.tests>src</sonar.tests> + <sonar.scm.exclusions.disabled>true</sonar.scm.exclusions.disabled> <sonar.sourceEncoding>UTF-8</sonar.sourceEncoding> + <sonar.nodejs.executable>node</sonar.nodejs.executable> </properties> <build> |