summaryrefslogtreecommitdiffstats
path: root/portal-FE-common
diff options
context:
space:
mode:
authorjegadeeshbabu3 <jegadeesh.babu@att.com>2020-03-16 20:49:49 +0530
committerjegadeeshbabu3 <jegadeesh.babu@att.com>2020-03-16 20:50:25 +0530
commitc953ac7f8c9a6ece47ba4b7195f8b9148944a45b (patch)
treea49ce80defc099ecd8de220b4e436a30d17f3cc6 /portal-FE-common
parentd7c3aae80ea1c8c9af4d7981bb77b68be7974427 (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>
Diffstat (limited to 'portal-FE-common')
-rw-r--r--portal-FE-common/src/app/pages/widget-onboarding/widget-onboarding.component.spec.ts51
1 files changed, 50 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();
+ });
});