summaryrefslogtreecommitdiffstats
path: root/portal-FE-common/src/app/shared
diff options
context:
space:
mode:
Diffstat (limited to 'portal-FE-common/src/app/shared')
-rw-r--r--portal-FE-common/src/app/shared/pipes/elipsis/elipsis.pipe.spec.ts8
-rw-r--r--portal-FE-common/src/app/shared/plugin/dynamic-widget/list-widget/list-widget.component.spec.ts8
-rw-r--r--portal-FE-common/src/app/shared/plugin/plugin.component.spec.ts8
-rw-r--r--portal-FE-common/src/app/shared/plugin/plugin.component.ts3
-rw-r--r--portal-FE-common/src/app/shared/services/admins/admins.service.spec.ts36
-rw-r--r--portal-FE-common/src/app/shared/services/application-catalog/application-catalog.service.spec.ts3
-rw-r--r--portal-FE-common/src/app/shared/services/applications/applications.service.spec.ts3
-rw-r--r--portal-FE-common/src/app/shared/services/basic-auth-account/basic-auth-account.service.spec.ts3
-rw-r--r--portal-FE-common/src/app/shared/services/contact-us/contact-us.service.spec.ts24
-rw-r--r--portal-FE-common/src/app/shared/services/external-request-access-service/external-request-access.service.spec.ts3
-rw-r--r--portal-FE-common/src/app/shared/services/functional-menu/functional-menu.service.spec.ts6
-rw-r--r--portal-FE-common/src/app/shared/services/get-access/get-access.service.spec.ts3
-rw-r--r--portal-FE-common/src/app/shared/services/global-search/global-search.service.spec.ts3
-rw-r--r--portal-FE-common/src/app/shared/services/manifest/manifest.service.spec.ts3
-rw-r--r--portal-FE-common/src/app/shared/services/menus/menus.service.spec.ts3
-rw-r--r--portal-FE-common/src/app/shared/services/microservice/microservice.service.spec.ts3
-rw-r--r--portal-FE-common/src/app/shared/services/notification/notification.service.spec.ts3
-rw-r--r--portal-FE-common/src/app/shared/services/portal-admins/portal-admin.service.spec.ts3
-rw-r--r--portal-FE-common/src/app/shared/services/role/role.service.spec.ts3
-rw-r--r--portal-FE-common/src/app/shared/services/scheduler/scheduler.service.spec.ts3
-rw-r--r--portal-FE-common/src/app/shared/services/sidebar/sidebar.service.spec.ts3
-rw-r--r--portal-FE-common/src/app/shared/services/tab/add-tab-function.service.spec.ts10
-rw-r--r--portal-FE-common/src/app/shared/services/user-profile/user-profile.service.spec.ts22
-rw-r--r--portal-FE-common/src/app/shared/services/userbar/userbar.service.spec.ts3
-rw-r--r--portal-FE-common/src/app/shared/services/users/users.service.spec.ts3
-rw-r--r--portal-FE-common/src/app/shared/services/utils/utils.service.spec.ts3
-rw-r--r--portal-FE-common/src/app/shared/services/webAnalytics/web-analytics.service.spec.ts3
-rw-r--r--portal-FE-common/src/app/shared/services/widget-catalog/widget-catalog.service.spec.ts3
-rw-r--r--portal-FE-common/src/app/shared/services/widget-onboarding/widget-onboarding.service.spec.ts3
29 files changed, 153 insertions, 32 deletions
diff --git a/portal-FE-common/src/app/shared/pipes/elipsis/elipsis.pipe.spec.ts b/portal-FE-common/src/app/shared/pipes/elipsis/elipsis.pipe.spec.ts
index 22a477d3..a553fb45 100644
--- a/portal-FE-common/src/app/shared/pipes/elipsis/elipsis.pipe.spec.ts
+++ b/portal-FE-common/src/app/shared/pipes/elipsis/elipsis.pipe.spec.ts
@@ -38,8 +38,14 @@
import { ElipsisPipe } from './elipsis.pipe';
describe('ElipsisPipe', () => {
+ let pipe;
it('create an instance', () => {
- const pipe = new ElipsisPipe();
+ pipe = new ElipsisPipe();
expect(pipe).toBeTruthy();
});
+ it('removeImage should return stubbed value', () => {
+ spyOn(pipe, 'transform').and.callThrough();
+ pipe.transform('PipeTest','2');
+ expect(pipe.transform).toHaveBeenCalledWith('PipeTest','2');
+ });
});
diff --git a/portal-FE-common/src/app/shared/plugin/dynamic-widget/list-widget/list-widget.component.spec.ts b/portal-FE-common/src/app/shared/plugin/dynamic-widget/list-widget/list-widget.component.spec.ts
index d7991933..6a367040 100644
--- a/portal-FE-common/src/app/shared/plugin/dynamic-widget/list-widget/list-widget.component.spec.ts
+++ b/portal-FE-common/src/app/shared/plugin/dynamic-widget/list-widget/list-widget.component.spec.ts
@@ -39,6 +39,10 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ListWidgetComponent } from './list-widget.component';
+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';
describe('ListWidgetComponent', () => {
let component: ListWidgetComponent;
@@ -46,7 +50,9 @@ describe('ListWidgetComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
- declarations: [ ListWidgetComponent ]
+ declarations: [ ListWidgetComponent ],
+ imports:[HttpClientTestingModule,FormsModule,NgMaterialModule,BrowserAnimationsModule]
+
})
.compileComponents();
}));
diff --git a/portal-FE-common/src/app/shared/plugin/plugin.component.spec.ts b/portal-FE-common/src/app/shared/plugin/plugin.component.spec.ts
index cc5810c1..59802bab 100644
--- a/portal-FE-common/src/app/shared/plugin/plugin.component.spec.ts
+++ b/portal-FE-common/src/app/shared/plugin/plugin.component.spec.ts
@@ -39,14 +39,18 @@
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { PluginComponent } from './plugin.component';
+import { ClientPluginLoaderService } from './plugin-loader/client-plugin-loader.service';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
describe('PluginComponent', () => {
let component: PluginComponent;
let fixture: ComponentFixture<PluginComponent>;
-
+ let clientPluginLoaderService: ClientPluginLoaderService;
beforeEach(async(() => {
TestBed.configureTestingModule({
- declarations: [ PluginComponent ]
+ declarations: [ PluginComponent ],
+ providers:[ClientPluginLoaderService],
+ imports: [HttpClientTestingModule]
})
.compileComponents();
}));
diff --git a/portal-FE-common/src/app/shared/plugin/plugin.component.ts b/portal-FE-common/src/app/shared/plugin/plugin.component.ts
index b64ea7c9..8c6202ec 100644
--- a/portal-FE-common/src/app/shared/plugin/plugin.component.ts
+++ b/portal-FE-common/src/app/shared/plugin/plugin.component.ts
@@ -44,6 +44,7 @@ import {
ViewContainerRef
} from '@angular/core';
import { PluginLoaderService } from './plugin-loader/plugin-loader.service';
+import { ClientPluginLoaderService } from './plugin-loader/client-plugin-loader.service';
@Component({
selector: 'app-plugin',
@@ -55,7 +56,7 @@ export class PluginComponent implements OnInit {
constructor(
private injector: Injector,
- private pluginLoader: PluginLoaderService
+ private pluginLoader: ClientPluginLoaderService
) {}
ngOnInit() {
diff --git a/portal-FE-common/src/app/shared/services/admins/admins.service.spec.ts b/portal-FE-common/src/app/shared/services/admins/admins.service.spec.ts
index ea61061b..1d8a643b 100644
--- a/portal-FE-common/src/app/shared/services/admins/admins.service.spec.ts
+++ b/portal-FE-common/src/app/shared/services/admins/admins.service.spec.ts
@@ -1,12 +1,44 @@
import { TestBed } from '@angular/core/testing';
import { AdminsService } from './admins.service';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
describe('AdminsService', () => {
- beforeEach(() => TestBed.configureTestingModule({}));
+ let service: AdminsService;
+ beforeEach(() => TestBed.configureTestingModule({
+ imports:[HttpClientTestingModule]
+ }));
it('should be created', () => {
- const service: AdminsService = TestBed.get(AdminsService);
+ service = TestBed.get(AdminsService);
expect(service).toBeTruthy();
});
+ it('getAdminAppsRoles should return stubbed value', () => {
+ spyOn(service, 'getAdminAppsRoles').and.callThrough();
+ service.getAdminAppsRoles("test");
+ expect(service.getAdminAppsRoles).toHaveBeenCalledWith("test");
+ });
+ it('getRolesByApp should return stubbed value', () => {
+ spyOn(service, 'getRolesByApp').and.callThrough();
+ service.getRolesByApp("test");
+ expect(service.getRolesByApp).toHaveBeenCalledWith("test");
+ });
+
+ it('updateAdminAppsRoles should return stubbed value', () => {
+ spyOn(service, 'updateAdminAppsRoles').and.callThrough();
+ service.updateAdminAppsRoles("test");
+ expect(service.updateAdminAppsRoles).toHaveBeenCalledWith("test");
+ });
+
+ it('isComplexPassword should return stubbed value', () => {
+ spyOn(service, 'isComplexPassword').and.callThrough();
+ service.isComplexPassword("testpassword");
+ expect(service.isComplexPassword).toHaveBeenCalledWith("testpassword");
+ });
+
+ it('addNewUser should return stubbed value', () => {
+ spyOn(service, 'addNewUser').and.callThrough();
+ service.addNewUser("testuser","duplicatecheck");
+ expect(service.addNewUser).toHaveBeenCalledWith("testuser","duplicatecheck");
+ });
});
diff --git a/portal-FE-common/src/app/shared/services/application-catalog/application-catalog.service.spec.ts b/portal-FE-common/src/app/shared/services/application-catalog/application-catalog.service.spec.ts
index 5f789869..92c0a72c 100644
--- a/portal-FE-common/src/app/shared/services/application-catalog/application-catalog.service.spec.ts
+++ b/portal-FE-common/src/app/shared/services/application-catalog/application-catalog.service.spec.ts
@@ -38,9 +38,10 @@
import { TestBed } from '@angular/core/testing';
import { ApplicationCatalogService } from './application-catalog.service';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
describe('ApplicationCatalogService', () => {
- beforeEach(() => TestBed.configureTestingModule({}));
+ beforeEach(() => TestBed.configureTestingModule({imports:[HttpClientTestingModule]}));
it('should be created', () => {
const service: ApplicationCatalogService = TestBed.get(ApplicationCatalogService);
diff --git a/portal-FE-common/src/app/shared/services/applications/applications.service.spec.ts b/portal-FE-common/src/app/shared/services/applications/applications.service.spec.ts
index 68017384..f4f36e3b 100644
--- a/portal-FE-common/src/app/shared/services/applications/applications.service.spec.ts
+++ b/portal-FE-common/src/app/shared/services/applications/applications.service.spec.ts
@@ -39,9 +39,10 @@
import { TestBed } from '@angular/core/testing';
import { ApplicationsService } from './applications.service';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
describe('ApplicationsService', () => {
- beforeEach(() => TestBed.configureTestingModule({}));
+ beforeEach(() => TestBed.configureTestingModule({imports:[HttpClientTestingModule]}));
it('should be created', () => {
const service: ApplicationsService = TestBed.get(ApplicationsService);
diff --git a/portal-FE-common/src/app/shared/services/basic-auth-account/basic-auth-account.service.spec.ts b/portal-FE-common/src/app/shared/services/basic-auth-account/basic-auth-account.service.spec.ts
index 4a6c0f43..72267b95 100644
--- a/portal-FE-common/src/app/shared/services/basic-auth-account/basic-auth-account.service.spec.ts
+++ b/portal-FE-common/src/app/shared/services/basic-auth-account/basic-auth-account.service.spec.ts
@@ -39,9 +39,10 @@
import { TestBed } from '@angular/core/testing';
import { BasicAuthAccountService } from './basic-auth-account.service';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
describe('BasicAuthAccountService', () => {
- beforeEach(() => TestBed.configureTestingModule({}));
+ beforeEach(() => TestBed.configureTestingModule({imports:[HttpClientTestingModule]}));
it('should be created', () => {
const service: BasicAuthAccountService = TestBed.get(BasicAuthAccountService);
diff --git a/portal-FE-common/src/app/shared/services/contact-us/contact-us.service.spec.ts b/portal-FE-common/src/app/shared/services/contact-us/contact-us.service.spec.ts
index 03d55d05..3a91b523 100644
--- a/portal-FE-common/src/app/shared/services/contact-us/contact-us.service.spec.ts
+++ b/portal-FE-common/src/app/shared/services/contact-us/contact-us.service.spec.ts
@@ -39,12 +39,34 @@
import { TestBed } from '@angular/core/testing';
import { ContactUsService } from './contact-us.service';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
describe('ContactUsService', () => {
- beforeEach(() => TestBed.configureTestingModule({}));
+ beforeEach(() => TestBed.configureTestingModule({imports:[HttpClientTestingModule]}));
it('should be created', () => {
const service: ContactUsService = TestBed.get(ContactUsService);
expect(service).toBeTruthy();
});
+
+ it('addContactUs should return stubbed value', () => {
+ const service: ContactUsService = TestBed.get(ContactUsService);
+ spyOn(service, 'addContactUs').and.callThrough();
+ service.addContactUs("TEST");
+ expect(service.addContactUs).toHaveBeenCalledWith("TEST")
+ });
+
+ it('modifyContactUs should return stubbed value', () => {
+ const service: ContactUsService = TestBed.get(ContactUsService);
+ spyOn(service, 'modifyContactUs').and.callThrough();
+ service.modifyContactUs("TEST");
+ expect(service.modifyContactUs).toHaveBeenCalledWith("TEST")
+ });
+
+ it('removeContactUs should return stubbed value', () => {
+ const service: ContactUsService = TestBed.get(ContactUsService);
+ spyOn(service, 'removeContactUs').and.callThrough();
+ service.removeContactUs("TEST");
+ expect(service.removeContactUs).toHaveBeenCalledWith("TEST")
+ });
});
diff --git a/portal-FE-common/src/app/shared/services/external-request-access-service/external-request-access.service.spec.ts b/portal-FE-common/src/app/shared/services/external-request-access-service/external-request-access.service.spec.ts
index d7f33e92..09de2297 100644
--- a/portal-FE-common/src/app/shared/services/external-request-access-service/external-request-access.service.spec.ts
+++ b/portal-FE-common/src/app/shared/services/external-request-access-service/external-request-access.service.spec.ts
@@ -1,9 +1,10 @@
import { TestBed } from '@angular/core/testing';
import { ExternalRequestAccessService } from './external-request-access.service';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
describe('ExternalRequestAccessService', () => {
- beforeEach(() => TestBed.configureTestingModule({}));
+ beforeEach(() => TestBed.configureTestingModule({imports:[HttpClientTestingModule]}));
it('should be created', () => {
const service: ExternalRequestAccessService = TestBed.get(ExternalRequestAccessService);
diff --git a/portal-FE-common/src/app/shared/services/functional-menu/functional-menu.service.spec.ts b/portal-FE-common/src/app/shared/services/functional-menu/functional-menu.service.spec.ts
index 1280c084..29088672 100644
--- a/portal-FE-common/src/app/shared/services/functional-menu/functional-menu.service.spec.ts
+++ b/portal-FE-common/src/app/shared/services/functional-menu/functional-menu.service.spec.ts
@@ -38,9 +38,13 @@
import { TestBed } from '@angular/core/testing';
import { FunctionalMenuService } from './functional-menu.service';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+
describe('FunctionalMenuService', () => {
- beforeEach(() => TestBed.configureTestingModule({}));
+ beforeEach(() => TestBed.configureTestingModule({
+ imports:[HttpClientTestingModule]}
+ ));
it('should be created', () => {
const service: FunctionalMenuService = TestBed.get(FunctionalMenuService);
diff --git a/portal-FE-common/src/app/shared/services/get-access/get-access.service.spec.ts b/portal-FE-common/src/app/shared/services/get-access/get-access.service.spec.ts
index 2f0c96a8..f98d3360 100644
--- a/portal-FE-common/src/app/shared/services/get-access/get-access.service.spec.ts
+++ b/portal-FE-common/src/app/shared/services/get-access/get-access.service.spec.ts
@@ -1,9 +1,10 @@
import { TestBed } from '@angular/core/testing';
import { GetAccessService } from './get-access.service';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
describe('GetAccessService', () => {
- beforeEach(() => TestBed.configureTestingModule({}));
+ beforeEach(() => TestBed.configureTestingModule({imports:[HttpClientTestingModule]}));
it('should be created', () => {
const service: GetAccessService = TestBed.get(GetAccessService);
diff --git a/portal-FE-common/src/app/shared/services/global-search/global-search.service.spec.ts b/portal-FE-common/src/app/shared/services/global-search/global-search.service.spec.ts
index 50ccebbf..4e384c10 100644
--- a/portal-FE-common/src/app/shared/services/global-search/global-search.service.spec.ts
+++ b/portal-FE-common/src/app/shared/services/global-search/global-search.service.spec.ts
@@ -38,9 +38,10 @@
import { TestBed } from '@angular/core/testing';
import { GlobalSearchService } from './global-search.service';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
describe('GlobalSearchService', () => {
- beforeEach(() => TestBed.configureTestingModule({}));
+ beforeEach(() => TestBed.configureTestingModule({imports:[HttpClientTestingModule]}));
it('should be created', () => {
const service: GlobalSearchService = TestBed.get(GlobalSearchService);
diff --git a/portal-FE-common/src/app/shared/services/manifest/manifest.service.spec.ts b/portal-FE-common/src/app/shared/services/manifest/manifest.service.spec.ts
index a5ad81b1..85e6e294 100644
--- a/portal-FE-common/src/app/shared/services/manifest/manifest.service.spec.ts
+++ b/portal-FE-common/src/app/shared/services/manifest/manifest.service.spec.ts
@@ -1,9 +1,10 @@
import { TestBed } from '@angular/core/testing';
import { ManifestService } from './manifest.service';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
describe('ManifestService', () => {
- beforeEach(() => TestBed.configureTestingModule({}));
+ beforeEach(() => TestBed.configureTestingModule({imports:[HttpClientTestingModule]}));
it('should be created', () => {
const service: ManifestService = TestBed.get(ManifestService);
diff --git a/portal-FE-common/src/app/shared/services/menus/menus.service.spec.ts b/portal-FE-common/src/app/shared/services/menus/menus.service.spec.ts
index b624236a..ad345d11 100644
--- a/portal-FE-common/src/app/shared/services/menus/menus.service.spec.ts
+++ b/portal-FE-common/src/app/shared/services/menus/menus.service.spec.ts
@@ -38,9 +38,10 @@
import { TestBed } from '@angular/core/testing';
import { MenusService } from './menus.service';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
describe('MenusService', () => {
- beforeEach(() => TestBed.configureTestingModule({}));
+ beforeEach(() => TestBed.configureTestingModule({imports:[HttpClientTestingModule]}));
it('should be created', () => {
const service: MenusService = TestBed.get(MenusService);
diff --git a/portal-FE-common/src/app/shared/services/microservice/microservice.service.spec.ts b/portal-FE-common/src/app/shared/services/microservice/microservice.service.spec.ts
index 439a9480..aa3229eb 100644
--- a/portal-FE-common/src/app/shared/services/microservice/microservice.service.spec.ts
+++ b/portal-FE-common/src/app/shared/services/microservice/microservice.service.spec.ts
@@ -38,9 +38,10 @@
import { TestBed } from '@angular/core/testing';
import { MicroserviceService } from './microservice.service';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
describe('MicroserviceService', () => {
- beforeEach(() => TestBed.configureTestingModule({}));
+ beforeEach(() => TestBed.configureTestingModule({imports:[HttpClientTestingModule]}));
it('should be created', () => {
const service: MicroserviceService = TestBed.get(MicroserviceService);
diff --git a/portal-FE-common/src/app/shared/services/notification/notification.service.spec.ts b/portal-FE-common/src/app/shared/services/notification/notification.service.spec.ts
index b8f0d334..fdaec249 100644
--- a/portal-FE-common/src/app/shared/services/notification/notification.service.spec.ts
+++ b/portal-FE-common/src/app/shared/services/notification/notification.service.spec.ts
@@ -39,9 +39,10 @@
import { TestBed } from '@angular/core/testing';
import { NotificationService } from './notification.service';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
describe('NotificationService', () => {
- beforeEach(() => TestBed.configureTestingModule({}));
+ beforeEach(() => TestBed.configureTestingModule({imports:[HttpClientTestingModule]}));
it('should be created', () => {
const service: NotificationService = TestBed.get(NotificationService);
diff --git a/portal-FE-common/src/app/shared/services/portal-admins/portal-admin.service.spec.ts b/portal-FE-common/src/app/shared/services/portal-admins/portal-admin.service.spec.ts
index e984467e..932d01ec 100644
--- a/portal-FE-common/src/app/shared/services/portal-admins/portal-admin.service.spec.ts
+++ b/portal-FE-common/src/app/shared/services/portal-admins/portal-admin.service.spec.ts
@@ -1,9 +1,10 @@
import { TestBed } from '@angular/core/testing';
import { PortalAdminsService } from './portal-admin.service';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
describe('AdminsService', () => {
- beforeEach(() => TestBed.configureTestingModule({}));
+ beforeEach(() => TestBed.configureTestingModule({imports:[HttpClientTestingModule]}));
it('should be created', () => {
const service: PortalAdminsService = TestBed.get(PortalAdminsService);
diff --git a/portal-FE-common/src/app/shared/services/role/role.service.spec.ts b/portal-FE-common/src/app/shared/services/role/role.service.spec.ts
index e5935616..96802f84 100644
--- a/portal-FE-common/src/app/shared/services/role/role.service.spec.ts
+++ b/portal-FE-common/src/app/shared/services/role/role.service.spec.ts
@@ -38,9 +38,10 @@
import { TestBed } from '@angular/core/testing';
import { RoleService } from './role.service';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
describe('RoleService', () => {
- beforeEach(() => TestBed.configureTestingModule({}));
+ beforeEach(() => TestBed.configureTestingModule({imports:[HttpClientTestingModule]}));
it('should be created', () => {
const service: RoleService = TestBed.get(RoleService);
diff --git a/portal-FE-common/src/app/shared/services/scheduler/scheduler.service.spec.ts b/portal-FE-common/src/app/shared/services/scheduler/scheduler.service.spec.ts
index dbeb9b6a..a473acde 100644
--- a/portal-FE-common/src/app/shared/services/scheduler/scheduler.service.spec.ts
+++ b/portal-FE-common/src/app/shared/services/scheduler/scheduler.service.spec.ts
@@ -38,9 +38,10 @@
import { TestBed } from '@angular/core/testing';
import { SchedulerService } from './scheduler.service';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
describe('SchedulerService', () => {
- beforeEach(() => TestBed.configureTestingModule({}));
+ beforeEach(() => TestBed.configureTestingModule({imports:[HttpClientTestingModule]}));
it('should be created', () => {
const service: SchedulerService = TestBed.get(SchedulerService);
diff --git a/portal-FE-common/src/app/shared/services/sidebar/sidebar.service.spec.ts b/portal-FE-common/src/app/shared/services/sidebar/sidebar.service.spec.ts
index 065e6e56..15fffb63 100644
--- a/portal-FE-common/src/app/shared/services/sidebar/sidebar.service.spec.ts
+++ b/portal-FE-common/src/app/shared/services/sidebar/sidebar.service.spec.ts
@@ -38,9 +38,10 @@
import { TestBed } from '@angular/core/testing';
import { SidebarService } from './sidebar.service';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
describe('SidenavService', () => {
- beforeEach(() => TestBed.configureTestingModule({}));
+ beforeEach(() => TestBed.configureTestingModule({imports:[HttpClientTestingModule]}));
it('should be created', () => {
const service: SidebarService = TestBed.get(SidebarService);
diff --git a/portal-FE-common/src/app/shared/services/tab/add-tab-function.service.spec.ts b/portal-FE-common/src/app/shared/services/tab/add-tab-function.service.spec.ts
index 70ae8043..55a7ba0b 100644
--- a/portal-FE-common/src/app/shared/services/tab/add-tab-function.service.spec.ts
+++ b/portal-FE-common/src/app/shared/services/tab/add-tab-function.service.spec.ts
@@ -38,12 +38,20 @@
import { TestBed } from '@angular/core/testing';
import { AddTabFunctionService } from './add-tab-function.service';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
describe('AddTabFunctionService', () => {
- beforeEach(() => TestBed.configureTestingModule({}));
+ beforeEach(() => TestBed.configureTestingModule({imports:[HttpClientTestingModule]}));
it('should be created', () => {
const service: AddTabFunctionService = TestBed.get(AddTabFunctionService);
expect(service).toBeTruthy();
});
+
+ it('filter should return stubbed value', () => {
+ const service: AddTabFunctionService = TestBed.get(AddTabFunctionService);
+ spyOn(service, 'filter').and.callThrough();
+ service.filter("TEST");
+ expect(service.filter).toHaveBeenCalledWith("TEST")
+ });
});
diff --git a/portal-FE-common/src/app/shared/services/user-profile/user-profile.service.spec.ts b/portal-FE-common/src/app/shared/services/user-profile/user-profile.service.spec.ts
index b1d5e6bd..265ae405 100644
--- a/portal-FE-common/src/app/shared/services/user-profile/user-profile.service.spec.ts
+++ b/portal-FE-common/src/app/shared/services/user-profile/user-profile.service.spec.ts
@@ -38,12 +38,30 @@
import { TestBed } from '@angular/core/testing';
import { UserProfileService } from './user-profile.service';
-
+import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { Observable } from 'rxjs';
+import 'rxjs/add/observable/of';
describe('UserProfileService', () => {
- beforeEach(() => TestBed.configureTestingModule({}));
+ // set the value to return when the `getValue` spy is called.
+ const stubValue = 'stub value';
+ const NODE_CONFIG: Array<any> = [];
+ beforeEach(() =>
+ {
+ TestBed.configureTestingModule({imports:[HttpClientTestingModule]})
+
+ }
+
+ );
it('should be created', () => {
const service: UserProfileService = TestBed.get(UserProfileService);
expect(service).toBeTruthy();
});
+
+ it('getUserAppRoles should return stubbed value', () => {
+ const service: UserProfileService = TestBed.get(UserProfileService);
+ spyOn(service, 'getUserAppRoles').and.callThrough();
+ service.getUserAppRoles("TEST");
+ expect(service.getUserAppRoles).toHaveBeenCalledWith("TEST")
+ });
});
diff --git a/portal-FE-common/src/app/shared/services/userbar/userbar.service.spec.ts b/portal-FE-common/src/app/shared/services/userbar/userbar.service.spec.ts
index 24329626..924c85c3 100644
--- a/portal-FE-common/src/app/shared/services/userbar/userbar.service.spec.ts
+++ b/portal-FE-common/src/app/shared/services/userbar/userbar.service.spec.ts
@@ -1,9 +1,10 @@
import { TestBed } from '@angular/core/testing';
import { UserbarService } from './userbar.service';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
describe('UserbarService', () => {
- beforeEach(() => TestBed.configureTestingModule({}));
+ beforeEach(() => TestBed.configureTestingModule({imports:[HttpClientTestingModule]}));
it('should be created', () => {
const service: UserbarService = TestBed.get(UserbarService);
diff --git a/portal-FE-common/src/app/shared/services/users/users.service.spec.ts b/portal-FE-common/src/app/shared/services/users/users.service.spec.ts
index c1f41d8a..cd30d995 100644
--- a/portal-FE-common/src/app/shared/services/users/users.service.spec.ts
+++ b/portal-FE-common/src/app/shared/services/users/users.service.spec.ts
@@ -38,9 +38,10 @@
import { TestBed } from '@angular/core/testing';
import { UsersService } from './users.service';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
describe('UsersService', () => {
- beforeEach(() => TestBed.configureTestingModule({}));
+ beforeEach(() => TestBed.configureTestingModule({imports:[HttpClientTestingModule]}));
it('should be created', () => {
const service: UsersService = TestBed.get(UsersService);
diff --git a/portal-FE-common/src/app/shared/services/utils/utils.service.spec.ts b/portal-FE-common/src/app/shared/services/utils/utils.service.spec.ts
index 102bf3d4..1d4d168d 100644
--- a/portal-FE-common/src/app/shared/services/utils/utils.service.spec.ts
+++ b/portal-FE-common/src/app/shared/services/utils/utils.service.spec.ts
@@ -1,9 +1,10 @@
import { TestBed } from '@angular/core/testing';
import { UtilsService } from './utils.service';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
describe('UtilsService', () => {
- beforeEach(() => TestBed.configureTestingModule({}));
+ beforeEach(() => TestBed.configureTestingModule({imports:[HttpClientTestingModule]}));
it('should be created', () => {
const service: UtilsService = TestBed.get(UtilsService);
diff --git a/portal-FE-common/src/app/shared/services/webAnalytics/web-analytics.service.spec.ts b/portal-FE-common/src/app/shared/services/webAnalytics/web-analytics.service.spec.ts
index 0c9b86bf..45e0c5b5 100644
--- a/portal-FE-common/src/app/shared/services/webAnalytics/web-analytics.service.spec.ts
+++ b/portal-FE-common/src/app/shared/services/webAnalytics/web-analytics.service.spec.ts
@@ -39,9 +39,10 @@
import { TestBed } from '@angular/core/testing';
import { WebAnalyticsService } from './web-analytics.service';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
describe('WebAnalyticsService', () => {
- beforeEach(() => TestBed.configureTestingModule({}));
+ beforeEach(() => TestBed.configureTestingModule({imports:[HttpClientTestingModule]}));
it('should be created', () => {
const service: WebAnalyticsService = TestBed.get(WebAnalyticsService);
diff --git a/portal-FE-common/src/app/shared/services/widget-catalog/widget-catalog.service.spec.ts b/portal-FE-common/src/app/shared/services/widget-catalog/widget-catalog.service.spec.ts
index fb87e8b9..bceef7c7 100644
--- a/portal-FE-common/src/app/shared/services/widget-catalog/widget-catalog.service.spec.ts
+++ b/portal-FE-common/src/app/shared/services/widget-catalog/widget-catalog.service.spec.ts
@@ -38,9 +38,10 @@
import { TestBed } from '@angular/core/testing';
import { WidgetCatalogService } from './widget-catalog.service';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
describe('WidgetCatalogService', () => {
- beforeEach(() => TestBed.configureTestingModule({}));
+ beforeEach(() => TestBed.configureTestingModule({imports:[HttpClientTestingModule]}));
it('should be created', () => {
const service: WidgetCatalogService = TestBed.get(WidgetCatalogService);
diff --git a/portal-FE-common/src/app/shared/services/widget-onboarding/widget-onboarding.service.spec.ts b/portal-FE-common/src/app/shared/services/widget-onboarding/widget-onboarding.service.spec.ts
index 90e53269..f7214a5b 100644
--- a/portal-FE-common/src/app/shared/services/widget-onboarding/widget-onboarding.service.spec.ts
+++ b/portal-FE-common/src/app/shared/services/widget-onboarding/widget-onboarding.service.spec.ts
@@ -39,9 +39,10 @@
import { TestBed } from '@angular/core/testing';
import { WidgetOnboardingService } from './widget-onboarding.service';
+import { HttpClientTestingModule } from '@angular/common/http/testing';
describe('WidgetOnboardingService', () => {
- beforeEach(() => TestBed.configureTestingModule({}));
+ beforeEach(() => TestBed.configureTestingModule({imports:[HttpClientTestingModule]}));
it('should be created', () => {
const service: WidgetOnboardingService = TestBed.get(WidgetOnboardingService);