diff --git a/lib/content-services/src/lib/agent/services/agent.service.spec.ts b/lib/content-services/src/lib/agent/services/agent.service.spec.ts index 6c006c446e..832526a93b 100644 --- a/lib/content-services/src/lib/agent/services/agent.service.spec.ts +++ b/lib/content-services/src/lib/agent/services/agent.service.spec.ts @@ -16,7 +16,6 @@ */ import { TestBed } from '@angular/core/testing'; -import { CoreTestingModule } from '@alfresco/adf-core'; import { AgentService } from './agent.service'; import { Agent, AgentPaging } from '@alfresco/js-api'; @@ -53,10 +52,6 @@ describe('AgentService', () => { let agentService: AgentService; beforeEach(() => { - TestBed.configureTestingModule({ - imports: [CoreTestingModule] - }); - agentService = TestBed.inject(AgentService); }); diff --git a/lib/content-services/src/lib/common/services/nodes-api.service.spec.ts b/lib/content-services/src/lib/common/services/nodes-api.service.spec.ts index 2a9b4a192c..d553e8df63 100644 --- a/lib/content-services/src/lib/common/services/nodes-api.service.spec.ts +++ b/lib/content-services/src/lib/common/services/nodes-api.service.spec.ts @@ -16,8 +16,7 @@ */ import { TestBed } from '@angular/core/testing'; -import { HttpClientTestingModule } from '@angular/common/http/testing'; -import { CoreTestingModule, RedirectAuthService } from '@alfresco/adf-core'; +import { RedirectAuthService } from '@alfresco/adf-core'; import { EMPTY, firstValueFrom, of } from 'rxjs'; import { JobIdBodyEntry, SizeDetails, SizeDetailsEntry } from '@alfresco/js-api'; import { NodesApiService } from './nodes-api.service'; @@ -46,7 +45,6 @@ describe('NodesApiService', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [HttpClientTestingModule, CoreTestingModule], providers: [ NodesApiService, { provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }, diff --git a/lib/core/shell/README.md b/lib/core/shell/README.md index 1ec3c83f4b..5d8cd6a2b9 100644 --- a/lib/core/shell/README.md +++ b/lib/core/shell/README.md @@ -1,17 +1,21 @@ # @alfresco/adf-core/shell -Secondary entry point of `@alfresco/adf-core`. It can be used by importing from `@alfresco/adf-core/shell`. +Namespace: `@alfresco/adf-core/shell`. + +This module provides the main layout for the application, allowing you to define routes and guards for your application shell. # Shell -[ShellModule](./src/lib/shell.module.ts) is designated as a main layout for the application. +Passed routes are going to be attached to shell main route. -I order to attach routes to appShell, `withRoutes(routes: Routes | AppShellRoutesConfig)` method should be used. +```typescript +import { provideShellRoutes } from '@alfresco/adf-core/shell'; -Passed routes are going to be attached to [shell main route](./src/lib/shell.routes.ts) +provideShellRoutes([/*Your Routes*/]) +``` -If you would like to provide custom app guard, you can provide your own using [SHELL_AUTH_TOKEN](./src/lib/shell.routes.ts) +If you would like to provide custom app guard, you can provide your own using `SHELL_AUTH_TOKEN`. ## Shell Service -In order to use `shell`, you need to provide [SHELL_APP_SERVICE](./src/lib/services/shell-app.service.ts) which provides necessary options for shell component to work. +In order to use `shell`, you need to provide `SHELL_APP_SERVICE` which provides necessary options for shell component to work. diff --git a/lib/core/shell/src/index.ts b/lib/core/shell/src/index.ts index e433beecfd..f6c2a6f4cb 100644 --- a/lib/core/shell/src/index.ts +++ b/lib/core/shell/src/index.ts @@ -18,3 +18,4 @@ export * from './lib/shell.module'; export * from './lib/services/shell-app.service'; export * from './lib/components/shell/shell.component'; +export * from './lib/shell.routes'; diff --git a/lib/core/shell/src/lib/shell.module.ts b/lib/core/shell/src/lib/shell.module.ts index 30151da6a6..a71979fb4e 100644 --- a/lib/core/shell/src/lib/shell.module.ts +++ b/lib/core/shell/src/lib/shell.module.ts @@ -16,19 +16,11 @@ */ import { ModuleWithProviders, NgModule } from '@angular/core'; -import { Routes, provideRoutes, Route } from '@angular/router'; -import { SHELL_LAYOUT_ROUTE } from './shell.routes'; -import { ShellLayoutComponent } from './components/shell/shell.component'; +import { Routes, provideRouter } from '@angular/router'; +import { AppShellRoutesConfig, SHELL_LAYOUT_ROUTE } from './shell.routes'; -export interface AppShellRoutesConfig { - shellParentRoute?: Route; - shellChildren: Routes; -} - -@NgModule({ - imports: [ShellLayoutComponent], - exports: [ShellLayoutComponent] -}) +/** @deprecated use `provideShellRoutes` instead */ +@NgModule() export class ShellModule { static withRoutes(routes: Routes | AppShellRoutesConfig): ModuleWithProviders { if (Array.isArray(routes)) { @@ -54,7 +46,7 @@ function getModuleForRoutes(routes: Routes): ModuleWithProviders { return { ngModule: ShellModule, - providers: provideRoutes([shellLayoutRoute]) + providers: [provideRouter([shellLayoutRoute])] }; } @@ -84,6 +76,6 @@ function getModuleForRouteConfig(config: AppShellRoutesConfig): ModuleWithProvid return { ngModule: ShellModule, - providers: provideRoutes([rootRoute]) + providers: [provideRouter([rootRoute])] }; } diff --git a/lib/core/shell/src/lib/shell.routes.ts b/lib/core/shell/src/lib/shell.routes.ts index 5f108fdff5..ec57b0b2ff 100644 --- a/lib/core/shell/src/lib/shell.routes.ts +++ b/lib/core/shell/src/lib/shell.routes.ts @@ -15,9 +15,10 @@ * limitations under the License. */ -import { Route } from '@angular/router'; +import { provideRouter, Route, Routes } from '@angular/router'; import { ShellLayoutComponent } from './components/shell/shell.component'; import { SHELL_AUTH_TOKEN } from './services/shell-app.service'; +import { EnvironmentProviders } from '@angular/core'; export const SHELL_LAYOUT_ROUTE: Route = { path: '', @@ -25,3 +26,38 @@ export const SHELL_LAYOUT_ROUTE: Route = { canActivate: [SHELL_AUTH_TOKEN], children: [] }; + +export interface AppShellRoutesConfig { + shellParentRoute?: Route; + shellChildren: Routes; +} + +/** + * Provides shell routes for the application. + * + * @param routes The routes configuration for the shell. + * @returns An array of providers for the shell routes. + */ +export function provideShellRoutes(routes: Routes | AppShellRoutesConfig): EnvironmentProviders[] { + const shellLayoutRoute = SHELL_LAYOUT_ROUTE; + + if (Array.isArray(routes)) { + shellLayoutRoute.children.push(...routes); + return [provideRouter([shellLayoutRoute])]; + } + + const shellChildrenRoutes = routes.shellChildren || []; + if (shellChildrenRoutes.length > 0) { + shellLayoutRoute.children.push(...shellChildrenRoutes); + } + + const shellParentRoute = routes.shellParentRoute; + const rootRoute = shellParentRoute || shellLayoutRoute; + + if (routes.shellParentRoute) { + rootRoute.children = rootRoute.children || []; + rootRoute.children.push(shellLayoutRoute); + } + + return [provideRouter([rootRoute])]; +} diff --git a/lib/core/src/lib/app-config/app-config.module.ts b/lib/core/src/lib/app-config/app-config.module.ts index ffc1bfdc6a..f99bf292ee 100644 --- a/lib/core/src/lib/app-config/app-config.module.ts +++ b/lib/core/src/lib/app-config/app-config.module.ts @@ -18,9 +18,9 @@ import { NgModule } from '@angular/core'; import { AppConfigPipe } from './app-config.pipe'; +/** @deprecated This module is deprecated, consider importing AppConfigPipe directly */ @NgModule({ imports: [AppConfigPipe], exports: [AppConfigPipe] }) -/** @deprecated This module is deprecated, consider importing AppConfigPipe directly */ export class AppConfigModule {} diff --git a/lib/core/src/lib/app-config/provide-app-config.ts b/lib/core/src/lib/app-config/provide-app-config.ts new file mode 100644 index 0000000000..27bb289d1b --- /dev/null +++ b/lib/core/src/lib/app-config/provide-app-config.ts @@ -0,0 +1,43 @@ +/*! + * @license + * Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { inject, provideAppInitializer, Provider, EnvironmentProviders } from '@angular/core'; +import { StoragePrefixFactory } from './app-config-storage-prefix.factory'; +import { loadAppConfig } from './app-config.loader'; +import { AppConfigService } from './app-config.service'; +import { StorageService } from '../common'; +import { AdfHttpClient } from '@alfresco/adf-core/api'; + +/** + * Provides the application configuration for the application. + * + * @returns An array of providers to initialize the application configuration. + */ +export function provideAppConfig(): (Provider | EnvironmentProviders)[] { + return [ + StoragePrefixFactory, + provideAppInitializer(() => { + const initializerFn = loadAppConfig( + inject(AppConfigService), + inject(StorageService), + inject(AdfHttpClient), + inject(StoragePrefixFactory) + ); + return initializerFn(); + }) + ]; +} diff --git a/lib/core/src/lib/app-config/public-api.ts b/lib/core/src/lib/app-config/public-api.ts index 5041c7177f..5ed4e0dbd7 100644 --- a/lib/core/src/lib/app-config/public-api.ts +++ b/lib/core/src/lib/app-config/public-api.ts @@ -21,3 +21,4 @@ export * from './app-config.pipe'; export * from './app-config-storage-prefix.factory'; export * from './app-config.module'; +export * from './provide-app-config'; diff --git a/lib/core/src/lib/context-menu/context-menu.directive.spec.ts b/lib/core/src/lib/context-menu/context-menu.directive.spec.ts index fd7f5386f2..df5ce9ac32 100644 --- a/lib/core/src/lib/context-menu/context-menu.directive.spec.ts +++ b/lib/core/src/lib/context-menu/context-menu.directive.spec.ts @@ -17,7 +17,6 @@ import { Component } from '@angular/core'; import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { CoreTestingModule } from '../testing/core.testing.module'; import { HarnessLoader } from '@angular/cdk/testing'; import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed'; import { UnitTestingUtils } from '../testing/unit-testing-utils'; @@ -119,7 +118,7 @@ testCases.forEach((testCase) => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule, TestComponent] + imports: [TestComponent] }); fixture = TestBed.createComponent(TestComponent); fixture.componentInstance.isEnabled = false; diff --git a/lib/core/src/lib/core.module.ts b/lib/core/src/lib/core.module.ts index 60e0590194..331bc6683c 100644 --- a/lib/core/src/lib/core.module.ts +++ b/lib/core/src/lib/core.module.ts @@ -15,8 +15,8 @@ * limitations under the License. */ -import { NgModule, ModuleWithProviders, inject, provideAppInitializer } from '@angular/core'; -import { TranslateModule, TranslateLoader, TranslateStore, TranslateService } from '@ngx-translate/core'; +import { NgModule, ModuleWithProviders } from '@angular/core'; +import { TranslateLoader, provideTranslateService } from '@ngx-translate/core'; import { ABOUT_DIRECTIVES } from './about/about.module'; import { CARD_VIEW_DIRECTIVES } from './card-view/card-view.module'; import { CONTEXT_MENU_DIRECTIVES } from './context-menu/context-menu.module'; @@ -37,29 +37,24 @@ import { NOTIFICATION_HISTORY_DIRECTIVES } from './notifications/notification-hi import { BlankPageComponent } from './blank-page/blank-page.component'; import { CORE_DIRECTIVES } from './directives/directive.module'; import { CORE_PIPES } from './pipes/pipe.module'; -import { TranslationService } from './translation/translation.service'; import { TranslateLoaderService } from './translation/translate-loader.service'; import { SEARCH_TEXT_INPUT_DIRECTIVES } from './search-text/search-text-input.module'; -import { AdfHttpClient } from '@alfresco/adf-core/api'; import { AuthenticationInterceptor, Authentication } from '@alfresco/adf-core/auth'; -import { HttpClientModule, HttpClientXsrfModule, HTTP_INTERCEPTORS } from '@angular/common/http'; +import { HTTP_INTERCEPTORS, HttpClient, provideHttpClient, withXsrfConfiguration, withInterceptorsFromDi } from '@angular/common/http'; import { AuthenticationService } from './auth/services/authentication.service'; import { MAT_SNACK_BAR_DEFAULT_OPTIONS } from '@angular/material/snack-bar'; -import { loadAppConfig } from './app-config/app-config.loader'; -import { AppConfigService } from './app-config/app-config.service'; -import { StorageService } from './common/services/storage.service'; -import { MomentDateAdapter } from './common/utils/moment-date-adapter'; -import { AppConfigPipe, StoragePrefixFactory } from './app-config'; +import { AppConfigPipe } from './app-config'; import { IconComponent } from './icon'; import { SortingPickerComponent } from './sorting-picker'; import { DynamicChipListComponent } from './dynamic-chip-list'; import { IdentityUserInfoComponent } from './identity-user-info'; import { UnsavedChangesDialogComponent } from './dialogs'; import { MaterialModule } from './material.module'; +import { DecimalRenderMiddlewareService, FORM_FIELD_MODEL_RENDER_MIDDLEWARE } from './form'; +import { provideAppConfig } from './app-config/provide-app-config'; @NgModule({ imports: [ - TranslateModule, ...ABOUT_DIRECTIVES, ...VIEWER_DIRECTIVES, ...LAYOUT_DIRECTIVES, @@ -87,11 +82,6 @@ import { MaterialModule } from './material.module'; BlankPageComponent, UnsavedChangesDialogComponent, DynamicChipListComponent, - HttpClientModule, - HttpClientXsrfModule.withOptions({ - cookieName: 'CSRF-TOKEN', - headerName: 'X-CSRF-TOKEN' - }), MaterialModule ], providers: [...CORE_PIPES], @@ -115,7 +105,6 @@ import { MaterialModule } from './material.module'; ...LANGUAGE_MENU_DIRECTIVES, ...INFO_DRAWER_DIRECTIVES, ...DATATABLE_DIRECTIVES, - TranslateModule, ...TEMPLATE_DIRECTIVES, SortingPickerComponent, IconComponent, @@ -132,20 +121,16 @@ export class CoreModule { return { ngModule: CoreModule, providers: [ - TranslateStore, - TranslateService, - { provide: TranslateLoader, useClass: TranslateLoaderService }, - MomentDateAdapter, - StoragePrefixFactory, - provideAppInitializer(() => { - const initializerFn = loadAppConfig( - inject(AppConfigService), - inject(StorageService), - inject(AdfHttpClient), - inject(StoragePrefixFactory) - ); - return initializerFn(); + provideTranslateService({ + loader: { + provide: TranslateLoader, + useClass: TranslateLoaderService, + deps: [HttpClient] + }, + defaultLanguage: 'en' }), + provideAppConfig(), + provideHttpClient(withInterceptorsFromDi(), withXsrfConfiguration({ cookieName: 'CSRF-TOKEN', headerName: 'X-CSRF-TOKEN' })), { provide: HTTP_INTERCEPTORS, useClass: AuthenticationInterceptor, multi: true }, { provide: Authentication, useClass: AuthenticationService }, { @@ -153,6 +138,11 @@ export class CoreModule { useValue: { duration: 10000 } + }, + { + provide: FORM_FIELD_MODEL_RENDER_MIDDLEWARE, + useClass: DecimalRenderMiddlewareService, + multi: true } ] }; @@ -167,8 +157,4 @@ export class CoreModule { ngModule: CoreModule }; } - - constructor(translation: TranslationService) { - translation.addTranslationFolder('adf-core', 'assets/adf-core'); - } } diff --git a/lib/core/src/lib/datatable/components/datatable/datatable.component.spec.ts b/lib/core/src/lib/datatable/components/datatable/datatable.component.spec.ts index 97e1ce2593..4d26a6a6ea 100644 --- a/lib/core/src/lib/datatable/components/datatable/datatable.component.spec.ts +++ b/lib/core/src/lib/datatable/components/datatable/datatable.component.spec.ts @@ -24,7 +24,6 @@ import { DataSorting } from '../../data/data-sorting.model'; import { ObjectDataColumn } from '../../data/object-datacolumn.model'; import { ObjectDataTableAdapter } from '../../data/object-datatable-adapter'; import { DataTableComponent, ShowHeaderMode } from './datatable.component'; -import { CoreTestingModule } from '../../../testing/core.testing.module'; import { DataColumnListComponent } from '../../data-column/data-column-list.component'; import { DataColumnComponent } from '../../data-column/data-column.component'; import { CdkDrag, CdkDragDrop, CdkDropList } from '@angular/cdk/drag-drop'; @@ -35,6 +34,7 @@ import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed'; import { UnitTestingUtils } from '../../../testing/unit-testing-utils'; import { HarnessLoader } from '@angular/cdk/testing'; import { ConfigurableFocusTrapFactory } from '@angular/cdk/a11y'; +import { provideRouter } from '@angular/router'; @Component({ selector: 'adf-custom-column-template-component', @@ -146,7 +146,8 @@ describe('DataTable', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule, CustomColumnHeaderComponent] + imports: [CustomColumnHeaderComponent], + providers: [provideRouter([])] }); fixture = TestBed.createComponent(DataTableComponent); dataTable = fixture.componentInstance; @@ -1291,7 +1292,7 @@ describe('DataTable', () => { expect(dataTable.data.getColumns()).toEqual(expectedNewDataColumns); }); - it('should render the custom column header', () => { + it('should render the custom column header', async () => { const customHeader = TestBed.createComponent(CustomColumnHeaderComponent).componentInstance.templateRef; dataTable.data = new ObjectDataTableAdapter( [ @@ -1301,6 +1302,7 @@ describe('DataTable', () => { [new ObjectDataColumn({ key: 'id', title: 'ID' }), new ObjectDataColumn({ key: 'name', title: 'Name', header: customHeader })] ); fixture.detectChanges(); + await fixture.whenStable(); expect(testingUtils.getInnerTextByDataAutomationId('auto_id_id')).toContain('ID'); expect(testingUtils.getInnerTextByDataAutomationId('auto_id_name')).toContain('CUSTOM HEADER'); @@ -1518,7 +1520,7 @@ describe('Accessibility', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule, CustomColumnTemplateComponent], + imports: [CustomColumnTemplateComponent], providers: [{ provide: ConfigurableFocusTrapFactory, useValue: focusTrapFactory }], schemas: [NO_ERRORS_SCHEMA] }); @@ -1752,7 +1754,7 @@ describe('Drag&Drop column header', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule, CustomColumnTemplateComponent], + imports: [CustomColumnTemplateComponent], schemas: [NO_ERRORS_SCHEMA] }); fixture = TestBed.createComponent(DataTableComponent); @@ -1846,7 +1848,7 @@ describe('Show/hide columns', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule, CustomColumnTemplateComponent], + imports: [CustomColumnTemplateComponent], schemas: [NO_ERRORS_SCHEMA] }); fixture = TestBed.createComponent(DataTableComponent); @@ -1954,7 +1956,7 @@ describe('Column Resizing', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule, CustomColumnTemplateComponent], + imports: [CustomColumnTemplateComponent], schemas: [NO_ERRORS_SCHEMA] }); fixture = TestBed.createComponent(DataTableComponent); diff --git a/lib/core/src/lib/datatable/directives/header-filter-template.directive.spec.ts b/lib/core/src/lib/datatable/directives/header-filter-template.directive.spec.ts index 0052d66990..1de9e4f9d3 100644 --- a/lib/core/src/lib/datatable/directives/header-filter-template.directive.spec.ts +++ b/lib/core/src/lib/datatable/directives/header-filter-template.directive.spec.ts @@ -18,7 +18,6 @@ import { TestBed, ComponentFixture } from '@angular/core/testing'; import { DataTableComponent } from '../components/datatable/datatable.component'; import { HeaderFilterTemplateDirective } from './header-filter-template.directive'; -import { CoreTestingModule } from '../../testing/core.testing.module'; describe('HeaderFilterTemplateDirective', () => { let fixture: ComponentFixture; @@ -27,7 +26,7 @@ describe('HeaderFilterTemplateDirective', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule] + imports: [DataTableComponent] }); fixture = TestBed.createComponent(DataTableComponent); dataTable = fixture.componentInstance; diff --git a/lib/core/src/lib/datatable/directives/no-permission-template.directive.spec.ts b/lib/core/src/lib/datatable/directives/no-permission-template.directive.spec.ts index 507f1e37d0..1b5d32a55e 100644 --- a/lib/core/src/lib/datatable/directives/no-permission-template.directive.spec.ts +++ b/lib/core/src/lib/datatable/directives/no-permission-template.directive.spec.ts @@ -18,7 +18,6 @@ import { TestBed, ComponentFixture } from '@angular/core/testing'; import { DataTableComponent } from '../components/datatable/datatable.component'; import { NoPermissionTemplateDirective } from './no-permission-template.directive'; -import { CoreTestingModule } from '../../testing/core.testing.module'; describe('NoPermissionTemplateDirective', () => { let fixture: ComponentFixture; @@ -27,7 +26,7 @@ describe('NoPermissionTemplateDirective', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule] + imports: [DataTableComponent] }); fixture = TestBed.createComponent(DataTableComponent); dataTable = fixture.componentInstance; diff --git a/lib/core/src/lib/dialogs/dialog/dialog.component.spec.ts b/lib/core/src/lib/dialogs/dialog/dialog.component.spec.ts index a5abf7f9c1..63d621fc69 100644 --- a/lib/core/src/lib/dialogs/dialog/dialog.component.spec.ts +++ b/lib/core/src/lib/dialogs/dialog/dialog.component.spec.ts @@ -20,7 +20,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { DIALOG_COMPONENT_DATA, DialogComponent } from './dialog.component'; import { DialogData } from './dialog-data.interface'; import { DialogSize } from './dialog.model'; -import { CoreTestingModule, UnitTestingUtils } from '../../testing'; +import { UnitTestingUtils } from '../../testing'; import { Component, inject } from '@angular/core'; import { Subject } from 'rxjs'; @@ -56,7 +56,7 @@ describe('DialogComponent', () => { const setupBeforeEach = (dialogOptions: DialogData = data) => { TestBed.configureTestingModule({ - imports: [CoreTestingModule, DummyComponent], + imports: [DummyComponent], providers: [ { provide: MAT_DIALOG_DATA, useValue: dialogOptions }, { provide: MatDialogRef, useValue: dialogRef } diff --git a/lib/core/src/lib/dialogs/unsaved-changes-dialog/unsaved-changes-dialog.component.spec.ts b/lib/core/src/lib/dialogs/unsaved-changes-dialog/unsaved-changes-dialog.component.spec.ts index 27e5293906..16c4b34e26 100644 --- a/lib/core/src/lib/dialogs/unsaved-changes-dialog/unsaved-changes-dialog.component.spec.ts +++ b/lib/core/src/lib/dialogs/unsaved-changes-dialog/unsaved-changes-dialog.component.spec.ts @@ -16,7 +16,7 @@ */ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { AppConfigValues, CoreTestingModule, UnsavedChangesDialogComponent, UserPreferencesService } from '@alfresco/adf-core'; +import { AppConfigValues, UnsavedChangesDialogComponent, UserPreferencesService } from '@alfresco/adf-core'; import { DebugElement } from '@angular/core'; import { MAT_DIALOG_DATA, MatDialogClose } from '@angular/material/dialog'; import { UnsavedChangesDialogData } from './unsaved-changes-dialog.model'; @@ -30,7 +30,6 @@ describe('UnsavedChangesDialog', () => { const setupBeforeEach = (unsavedChangesDialogData?: UnsavedChangesDialogData) => { TestBed.configureTestingModule({ - imports: [CoreTestingModule], providers: [ { provide: MAT_DIALOG_DATA, diff --git a/lib/core/src/lib/dynamic-chip-list/dynamic-chip-list.component.spec.ts b/lib/core/src/lib/dynamic-chip-list/dynamic-chip-list.component.spec.ts index b9ddbf56c7..b06e797987 100644 --- a/lib/core/src/lib/dynamic-chip-list/dynamic-chip-list.component.spec.ts +++ b/lib/core/src/lib/dynamic-chip-list/dynamic-chip-list.component.spec.ts @@ -19,7 +19,6 @@ import { DebugElement, SimpleChange } from '@angular/core'; import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing'; import { Chip } from './chip'; import { DynamicChipListComponent } from './dynamic-chip-list.component'; -import { CoreTestingModule } from '../testing/core.testing.module'; import { UnitTestingUtils } from '../testing/unit-testing-utils'; describe('DynamicChipListComponent', () => { @@ -65,9 +64,6 @@ describe('DynamicChipListComponent', () => { } beforeEach(() => { - TestBed.configureTestingModule({ - imports: [CoreTestingModule] - }); const resizeObserverSpy = spyOn(window, 'ResizeObserver').and.callThrough(); fixture = TestBed.createComponent(DynamicChipListComponent); component = fixture.componentInstance; diff --git a/lib/core/src/lib/form/components/form-field/form-field.component.spec.ts b/lib/core/src/lib/form/components/form-field/form-field.component.spec.ts index 5f6ad2eaf6..037d9a90b2 100644 --- a/lib/core/src/lib/form/components/form-field/form-field.component.spec.ts +++ b/lib/core/src/lib/form/components/form-field/form-field.component.spec.ts @@ -16,7 +16,7 @@ */ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { CoreTestingModule, UnitTestingUtils } from '../../../testing'; +import { UnitTestingUtils } from '../../../testing'; import { FormRenderingService } from '../../services/form-rendering.service'; import { CheckboxWidgetComponent, FormFieldModel, FormFieldTypes, FormModel, TextWidgetComponent } from '../widgets'; import { FormFieldComponent } from './form-field.component'; @@ -31,7 +31,7 @@ describe('FormFieldComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule] + imports: [FormFieldComponent] }); fixture = TestBed.createComponent(FormFieldComponent); component = fixture.componentInstance; diff --git a/lib/core/src/lib/form/components/form-renderer.component.spec.ts b/lib/core/src/lib/form/components/form-renderer.component.spec.ts index 3a3cac09f9..be3f436bec 100644 --- a/lib/core/src/lib/form/components/form-renderer.component.spec.ts +++ b/lib/core/src/lib/form/components/form-renderer.component.spec.ts @@ -16,7 +16,7 @@ */ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { CoreTestingModule, UnitTestingUtils } from '../../testing'; +import { UnitTestingUtils } from '../../testing'; import { FormRulesManager } from '../models/form-rules.model'; import { FormRenderingService } from '../services/form-rendering.service'; import { FormService } from '../services/form.service'; @@ -90,7 +90,7 @@ describe('Form Renderer Component', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule] + imports: [FormRendererComponent] }); fixture = TestBed.createComponent(FormRendererComponent); formRendererComponent = fixture.componentInstance; diff --git a/lib/core/src/lib/form/components/form-section/form-section.component.spec.ts b/lib/core/src/lib/form/components/form-section/form-section.component.spec.ts index f7143fb6e6..8c138268ad 100644 --- a/lib/core/src/lib/form/components/form-section/form-section.component.spec.ts +++ b/lib/core/src/lib/form/components/form-section/form-section.component.spec.ts @@ -16,7 +16,7 @@ */ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { CoreTestingModule, UnitTestingUtils } from '../../../testing'; +import { UnitTestingUtils } from '../../../testing'; import { FormFieldModel, FormModel } from '../widgets'; import { FormSectionComponent } from './form-section.component'; import { mockSectionWithFields } from '../mock/form-renderer.component.mock'; @@ -28,7 +28,7 @@ describe('FormSectionComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule] + imports: [FormSectionComponent] }); fixture = TestBed.createComponent(FormSectionComponent); testingUtils = new UnitTestingUtils(fixture.debugElement); diff --git a/lib/core/src/lib/form/components/inplace-form-input/inplace-form-input.component.spec.ts b/lib/core/src/lib/form/components/inplace-form-input/inplace-form-input.component.spec.ts index 8e53acb45a..8b1d0b6db9 100644 --- a/lib/core/src/lib/form/components/inplace-form-input/inplace-form-input.component.spec.ts +++ b/lib/core/src/lib/form/components/inplace-form-input/inplace-form-input.component.spec.ts @@ -17,8 +17,8 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { UntypedFormControl } from '@angular/forms'; -import { CoreTestingModule, UnitTestingUtils } from '../../../testing'; import { InplaceFormInputComponent } from './inplace-form-input.component'; +import { UnitTestingUtils } from '../../../testing/unit-testing-utils'; describe('InplaceFormInputComponent', () => { let component: InplaceFormInputComponent; @@ -26,13 +26,10 @@ describe('InplaceFormInputComponent', () => { let formControl: UntypedFormControl; let testingUtils: UnitTestingUtils; - beforeEach(async () => { - await TestBed.configureTestingModule({ - imports: [CoreTestingModule, InplaceFormInputComponent] - }).compileComponents(); - }); - beforeEach(() => { + TestBed.configureTestingModule({ + imports: [InplaceFormInputComponent] + }); formControl = new UntypedFormControl(''); fixture = TestBed.createComponent(InplaceFormInputComponent); diff --git a/lib/core/src/lib/form/components/widgets/amount/amount.widget.spec.ts b/lib/core/src/lib/form/components/widgets/amount/amount.widget.spec.ts index 33276ef4d9..61f733f2e9 100644 --- a/lib/core/src/lib/form/components/widgets/amount/amount.widget.spec.ts +++ b/lib/core/src/lib/form/components/widgets/amount/amount.widget.spec.ts @@ -18,7 +18,6 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { FormFieldModel } from '../core/form-field.model'; import { AmountWidgetComponent, ADF_AMOUNT_SETTINGS } from './amount.widget'; -import { FormBaseModule } from '../../../form-base.module'; import { FormFieldTypes } from '../core/form-field-types'; import { FormModel } from '../core/form.model'; import { HarnessLoader } from '@angular/cdk/testing'; @@ -33,7 +32,7 @@ describe('AmountWidgetComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [FormBaseModule] + imports: [AmountWidgetComponent] }); fixture = TestBed.createComponent(AmountWidgetComponent); widget = fixture.componentInstance; @@ -131,7 +130,7 @@ describe('AmountWidgetComponent - rendering', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [FormBaseModule] + imports: [AmountWidgetComponent] }); fixture = TestBed.createComponent(AmountWidgetComponent); widget = fixture.componentInstance; @@ -336,7 +335,7 @@ describe('AmountWidgetComponent settings', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [FormBaseModule], + imports: [AmountWidgetComponent], providers: [ { provide: ADF_AMOUNT_SETTINGS, diff --git a/lib/core/src/lib/form/components/widgets/base-viewer/base-viewer.widget.spec.ts b/lib/core/src/lib/form/components/widgets/base-viewer/base-viewer.widget.spec.ts index d51e4c38e2..216628438c 100644 --- a/lib/core/src/lib/form/components/widgets/base-viewer/base-viewer.widget.spec.ts +++ b/lib/core/src/lib/form/components/widgets/base-viewer/base-viewer.widget.spec.ts @@ -16,7 +16,6 @@ */ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { CoreTestingModule } from '../../../../testing'; import { FormService } from '../../../services/form.service'; import { FormFieldModel, FormModel } from '../core'; import { BaseViewerWidgetComponent } from './base-viewer.widget'; @@ -44,7 +43,7 @@ describe('BaseViewerWidgetComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule, BaseViewerWidgetComponent], + imports: [BaseViewerWidgetComponent], providers: [{ provide: FormService, useValue: formServiceStub }] }); diff --git a/lib/core/src/lib/form/components/widgets/checkbox/checkbox.widget.spec.ts b/lib/core/src/lib/form/components/widgets/checkbox/checkbox.widget.spec.ts index 765b07dd9b..da9c6852d0 100644 --- a/lib/core/src/lib/form/components/widgets/checkbox/checkbox.widget.spec.ts +++ b/lib/core/src/lib/form/components/widgets/checkbox/checkbox.widget.spec.ts @@ -19,9 +19,7 @@ import { HarnessLoader } from '@angular/cdk/testing'; import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { MatCheckboxModule } from '@angular/material/checkbox'; -import { TranslateLoader } from '@ngx-translate/core'; -import { CoreTestingModule, UnitTestingUtils } from '../../../../testing'; -import { TranslateLoaderService } from '../../../../translation'; +import { UnitTestingUtils } from '../../../../testing'; import { FormFieldModel, FormFieldTypes, FormModel } from '../core'; import { CheckboxWidgetComponent } from './checkbox.widget'; @@ -33,8 +31,7 @@ describe('CheckboxWidgetComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule, MatCheckboxModule], - providers: [{ provide: TranslateLoader, useClass: TranslateLoaderService }] + imports: [MatCheckboxModule] }); fixture = TestBed.createComponent(CheckboxWidgetComponent); widget = fixture.componentInstance; diff --git a/lib/core/src/lib/form/components/widgets/core/form.model.spec.ts b/lib/core/src/lib/form/components/widgets/core/form.model.spec.ts index 805ce08c20..18ba31ad99 100644 --- a/lib/core/src/lib/form/components/widgets/core/form.model.spec.ts +++ b/lib/core/src/lib/form/components/widgets/core/form.model.spec.ts @@ -25,16 +25,11 @@ import { FormOutcomeModel } from './form-outcome.model'; import { FormModel } from './form.model'; import { TabModel } from './tab.model'; import { fakeMetadataForm, mockDisplayExternalPropertyForm, mockFormWithSections, fakeValidatorMock } from '../../mock/form.mock'; -import { CoreTestingModule } from '../../../../testing'; -import { TestBed } from '@angular/core/testing'; describe('FormModel', () => { let formService: FormService; beforeEach(() => { - TestBed.configureTestingModule({ - imports: [CoreTestingModule] - }); formService = new FormService(); }); diff --git a/lib/core/src/lib/form/components/widgets/date/date.widget.spec.ts b/lib/core/src/lib/form/components/widgets/date/date.widget.spec.ts index 49ee4dca23..f3f6fedf68 100644 --- a/lib/core/src/lib/form/components/widgets/date/date.widget.spec.ts +++ b/lib/core/src/lib/form/components/widgets/date/date.widget.spec.ts @@ -17,7 +17,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { DateAdapter } from '@angular/material/core'; -import { CoreTestingModule, UnitTestingUtils } from '../../../../testing'; +import { UnitTestingUtils } from '../../../../testing'; import { FormFieldModel, FormFieldTypes, FormModel } from '../core'; import { DateWidgetComponent } from './date.widget'; import { DEFAULT_DATE_FORMAT } from '../../../../common'; @@ -32,7 +32,7 @@ describe('DateWidgetComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule] + imports: [DateWidgetComponent] }); form = new FormModel(); diff --git a/lib/core/src/lib/form/components/widgets/decimal/decimal.component.spec.ts b/lib/core/src/lib/form/components/widgets/decimal/decimal.component.spec.ts index f8ad03a55e..3fdd71b3e5 100644 --- a/lib/core/src/lib/form/components/widgets/decimal/decimal.component.spec.ts +++ b/lib/core/src/lib/form/components/widgets/decimal/decimal.component.spec.ts @@ -19,7 +19,7 @@ import { HarnessLoader } from '@angular/cdk/testing'; import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { MatInputModule } from '@angular/material/input'; -import { CoreTestingModule, UnitTestingUtils } from '../../../../testing'; +import { UnitTestingUtils } from '../../../../testing'; import { FormService } from '../../../services/form.service'; import { FormFieldModel, FormFieldTypes, FormModel } from '../core'; import { DecimalWidgetComponent } from './decimal.component'; @@ -30,11 +30,11 @@ describe('DecimalComponent', () => { let fixture: ComponentFixture; let testingUtils: UnitTestingUtils; - beforeEach(async () => { - await TestBed.configureTestingModule({ - imports: [CoreTestingModule, MatInputModule, DecimalWidgetComponent], + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [MatInputModule, DecimalWidgetComponent], providers: [FormService] - }).compileComponents(); + }); fixture = TestBed.createComponent(DecimalWidgetComponent); widget = fixture.componentInstance; diff --git a/lib/core/src/lib/form/components/widgets/error/error.component.spec.ts b/lib/core/src/lib/form/components/widgets/error/error.component.spec.ts index e99bafb7ee..f08b193722 100644 --- a/lib/core/src/lib/form/components/widgets/error/error.component.spec.ts +++ b/lib/core/src/lib/form/components/widgets/error/error.component.spec.ts @@ -17,7 +17,7 @@ import { SimpleChange, SimpleChanges } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { CoreTestingModule, UnitTestingUtils } from '../../../../testing'; +import { UnitTestingUtils } from '../../../../testing'; import { ErrorMessageModel } from '../core'; import { ErrorWidgetComponent } from './error.component'; @@ -28,7 +28,7 @@ describe('ErrorWidgetComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule] + imports: [ErrorWidgetComponent] }); fixture = TestBed.createComponent(ErrorWidgetComponent); widget = fixture.componentInstance; diff --git a/lib/core/src/lib/form/components/widgets/hyperlink/hyperlink.widget.spec.ts b/lib/core/src/lib/form/components/widgets/hyperlink/hyperlink.widget.spec.ts index 410e4bd4d1..3a7e06a23a 100644 --- a/lib/core/src/lib/form/components/widgets/hyperlink/hyperlink.widget.spec.ts +++ b/lib/core/src/lib/form/components/widgets/hyperlink/hyperlink.widget.spec.ts @@ -16,7 +16,7 @@ */ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { CoreTestingModule, UnitTestingUtils } from '../../../../testing'; +import { UnitTestingUtils } from '../../../../testing'; import { FormFieldModel, FormFieldTypes, FormModel } from '../core'; import { HyperlinkWidgetComponent } from './hyperlink.widget'; @@ -27,7 +27,7 @@ describe('HyperlinkWidgetComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule] + imports: [HyperlinkWidgetComponent] }); fixture = TestBed.createComponent(HyperlinkWidgetComponent); widget = fixture.componentInstance; diff --git a/lib/core/src/lib/form/components/widgets/number/number.widget.spec.ts b/lib/core/src/lib/form/components/widgets/number/number.widget.spec.ts index 518d2d3f6a..80c12b8031 100644 --- a/lib/core/src/lib/form/components/widgets/number/number.widget.spec.ts +++ b/lib/core/src/lib/form/components/widgets/number/number.widget.spec.ts @@ -20,7 +20,7 @@ import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { MatIconModule } from '@angular/material/icon'; import { MatInputModule } from '@angular/material/input'; -import { CoreTestingModule, UnitTestingUtils } from '../../../../testing'; +import { UnitTestingUtils } from '../../../../testing'; import { FormFieldModel, FormFieldTypes, FormModel } from '../core'; import { NumberWidgetComponent } from './number.widget'; import { DecimalNumberPipe } from '../../../../pipes'; @@ -36,7 +36,7 @@ describe('NumberWidgetComponent', () => { mockDecimalNumberPipe = jasmine.createSpyObj('DecimalNumberPipe', ['transform']); await TestBed.configureTestingModule({ - imports: [CoreTestingModule, MatInputModule, MatIconModule] + imports: [MatInputModule, MatIconModule] }) .overrideComponent(NumberWidgetComponent, { set: { diff --git a/lib/core/src/lib/form/components/widgets/widget.component.spec.ts b/lib/core/src/lib/form/components/widgets/widget.component.spec.ts index e104bfc3ba..184c370638 100644 --- a/lib/core/src/lib/form/components/widgets/widget.component.spec.ts +++ b/lib/core/src/lib/form/components/widgets/widget.component.spec.ts @@ -17,7 +17,6 @@ import { ComponentFixture, fakeAsync, TestBed } from '@angular/core/testing'; import { filter } from 'rxjs/operators'; -import { CoreTestingModule } from '../../../testing'; import { FormRulesEvent } from '../../events'; import { FormFieldModel, FormModel } from './core'; import { WidgetComponent } from './widget.component'; @@ -29,7 +28,7 @@ describe('WidgetComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule] + imports: [WidgetComponent] }); fixture = TestBed.createComponent(WidgetComponent); diff --git a/lib/core/src/lib/form/form-base.module.ts b/lib/core/src/lib/form/form-base.module.ts index 64b71acdcf..789afc0034 100644 --- a/lib/core/src/lib/form/form-base.module.ts +++ b/lib/core/src/lib/form/form-base.module.ts @@ -20,10 +20,9 @@ import { StartFormCustomButtonDirective } from './components/form-custom-button. import { FormFieldComponent } from './components/form-field/form-field.component'; import { FormRendererComponent } from './components/form-renderer.component'; import { InplaceFormInputComponent } from './components/inplace-form-input/inplace-form-input.component'; -import { DecimalRenderMiddlewareService } from './components/middlewares/decimal-middleware.service'; -import { FORM_FIELD_MODEL_RENDER_MIDDLEWARE } from './components/middlewares/middleware'; import { MASK_DIRECTIVE, WIDGET_DIRECTIVES, WidgetComponent } from './components/widgets'; +/** @deprecated This module is deprecated and will be removed in a future release. Use standalone components instead. */ @NgModule({ imports: [ FormFieldComponent, @@ -34,7 +33,6 @@ import { MASK_DIRECTIVE, WIDGET_DIRECTIVES, WidgetComponent } from './components ...WIDGET_DIRECTIVES, ...MASK_DIRECTIVE ], - declarations: [], exports: [ FormFieldComponent, FormRendererComponent, @@ -42,13 +40,6 @@ import { MASK_DIRECTIVE, WIDGET_DIRECTIVES, WidgetComponent } from './components ...WIDGET_DIRECTIVES, InplaceFormInputComponent, WidgetComponent - ], - providers: [ - { - provide: FORM_FIELD_MODEL_RENDER_MIDDLEWARE, - useClass: DecimalRenderMiddlewareService, - multi: true - } ] }) export class FormBaseModule {} diff --git a/lib/core/src/lib/form/models/form-rules.model.spec.ts b/lib/core/src/lib/form/models/form-rules.model.spec.ts index 6888d95bc5..2c4d626748 100644 --- a/lib/core/src/lib/form/models/form-rules.model.spec.ts +++ b/lib/core/src/lib/form/models/form-rules.model.spec.ts @@ -18,7 +18,6 @@ import { Injector } from '@angular/core'; import { TestBed } from '@angular/core/testing'; import { getTestScheduler } from 'jasmine-marbles'; -import { CoreTestingModule } from '../../testing'; import { FormModel } from '../components/widgets'; import { FormEvent, FormRulesEvent } from '../events'; import { FormService } from '../services/form.service'; @@ -42,7 +41,6 @@ describe('Form Rules', () => { describe('Injection token provided', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule], providers: [ { provide: FORM_RULES_MANAGER, @@ -106,9 +104,6 @@ describe('Form Rules', () => { let getRulesSpy: jasmine.Spy; beforeEach(() => { - TestBed.configureTestingModule({ - imports: [CoreTestingModule] - }); injector = TestBed.inject(Injector); rulesManager = formRulesManagerFactory(injector); getRulesSpy = spyOn(rulesManager, 'getRules'); diff --git a/lib/core/src/lib/form/services/form.service.spec.ts b/lib/core/src/lib/form/services/form.service.spec.ts index 20eb60d41a..9099005c0a 100644 --- a/lib/core/src/lib/form/services/form.service.spec.ts +++ b/lib/core/src/lib/form/services/form.service.spec.ts @@ -18,7 +18,6 @@ import { TestBed } from '@angular/core/testing'; import { formModelTabs } from '../../mock'; import { FORM_SERVICE_FIELD_VALIDATORS_TOKEN, FormService } from './form.service'; -import { CoreTestingModule } from '../../testing'; import { FORM_FIELD_VALIDATORS, FormFieldValidator } from '../public-api'; const fakeValidator = { @@ -32,7 +31,7 @@ describe('Form service', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule], + imports: [], providers: [{ provide: FORM_SERVICE_FIELD_VALIDATORS_TOKEN, useValue: [fakeValidator] }] }); service = TestBed.inject(FormService); diff --git a/lib/core/src/lib/form/services/widget-visibility-cloud.service.spec.ts b/lib/core/src/lib/form/services/widget-visibility-cloud.service.spec.ts index 2318dadd1f..f08fb5662e 100644 --- a/lib/core/src/lib/form/services/widget-visibility-cloud.service.spec.ts +++ b/lib/core/src/lib/form/services/widget-visibility-cloud.service.spec.ts @@ -28,7 +28,6 @@ import { complexVisibilityJsonNotVisible, headerVisibilityCond } from '../../mock/form/widget-visibility-cloud.service.mock'; -import { CoreTestingModule } from '../../testing/core.testing.module'; declare let jasmine: any; @@ -39,9 +38,6 @@ describe('WidgetVisibilityCloudService', () => { const stubFormWithFields = new FormModel(fakeFormJson); beforeEach(() => { - TestBed.configureTestingModule({ - imports: [CoreTestingModule] - }); service = TestBed.inject(WidgetVisibilityService); jasmine.Ajax.install(); }); diff --git a/lib/core/src/lib/form/services/widget-visibility.service.spec.ts b/lib/core/src/lib/form/services/widget-visibility.service.spec.ts index dc40a08eb0..092bba0877 100644 --- a/lib/core/src/lib/form/services/widget-visibility.service.spec.ts +++ b/lib/core/src/lib/form/services/widget-visibility.service.spec.ts @@ -30,7 +30,6 @@ import { fakeFormChainedVisibilityJson, fakeFormCheckBoxVisibilityJson } from '../../mock/form/widget-visibility.service.mock'; -import { CoreTestingModule } from '../../testing/core.testing.module'; describe('WidgetVisibilityService', () => { let service: WidgetVisibilityService; @@ -48,9 +47,6 @@ describe('WidgetVisibilityService', () => { }; beforeEach(() => { - TestBed.configureTestingModule({ - imports: [CoreTestingModule] - }); service = TestBed.inject(WidgetVisibilityService); }); diff --git a/lib/core/src/lib/identity-user-info/identity-user-info.component.spec.ts b/lib/core/src/lib/identity-user-info/identity-user-info.component.spec.ts index 1718b371e2..c53b97aa4c 100644 --- a/lib/core/src/lib/identity-user-info/identity-user-info.component.spec.ts +++ b/lib/core/src/lib/identity-user-info/identity-user-info.component.spec.ts @@ -17,7 +17,6 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { IdentityUserInfoComponent } from './identity-user-info.component'; -import { CoreTestingModule } from '../testing/core.testing.module'; import { MatMenuModule } from '@angular/material/menu'; import { IdentityUserModel } from '../auth/models/identity-user.model'; import { UnitTestingUtils } from '../testing/unit-testing-utils'; @@ -51,7 +50,7 @@ describe('IdentityUserInfoComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule, MatMenuModule, IdentityUserInfoComponent] + imports: [MatMenuModule, IdentityUserInfoComponent] }); fixture = TestBed.createComponent(IdentityUserInfoComponent); component = fixture.componentInstance; diff --git a/lib/core/src/lib/language-menu/language-menu.component.spec.ts b/lib/core/src/lib/language-menu/language-menu.component.spec.ts index 71dc8084e4..a6039e03a7 100644 --- a/lib/core/src/lib/language-menu/language-menu.component.spec.ts +++ b/lib/core/src/lib/language-menu/language-menu.component.spec.ts @@ -18,7 +18,6 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { AppConfigService } from '../app-config/app-config.service'; import { LanguageMenuComponent } from './language-menu.component'; -import { CoreTestingModule } from '../testing/core.testing.module'; import { UserPreferencesService } from '../common/services/user-preferences.service'; import { LanguageService } from './service/language.service'; @@ -47,7 +46,7 @@ describe('LanguageMenuComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule, LanguageMenuComponent] + imports: [LanguageMenuComponent] }); fixture = TestBed.createComponent(LanguageMenuComponent); diff --git a/lib/core/src/lib/language-menu/language-picker.component.spec.ts b/lib/core/src/lib/language-menu/language-picker.component.spec.ts index 0660881991..6d7800b7d6 100644 --- a/lib/core/src/lib/language-menu/language-picker.component.spec.ts +++ b/lib/core/src/lib/language-menu/language-picker.component.spec.ts @@ -20,17 +20,17 @@ import { LanguagePickerComponent } from './language-picker.component'; import { MatMenuItem, MatMenuTrigger } from '@angular/material/menu'; import { LanguageMenuComponent } from './language-menu.component'; import { QueryList } from '@angular/core'; -import { CoreTestingModule, UnitTestingUtils } from '@alfresco/adf-core'; +import { UnitTestingUtils } from '@alfresco/adf-core'; describe('LanguagePickerComponent', () => { let component: LanguagePickerComponent; let fixture: ComponentFixture; let testingUtils: UnitTestingUtils; - beforeEach(async () => { - await TestBed.configureTestingModule({ - imports: [CoreTestingModule, LanguagePickerComponent] - }).compileComponents(); + beforeEach(() => { + TestBed.configureTestingModule({ + imports: [LanguagePickerComponent] + }); fixture = TestBed.createComponent(LanguagePickerComponent); testingUtils = new UnitTestingUtils(fixture.debugElement); diff --git a/lib/core/src/lib/layout/components/header/header.component.spec.ts b/lib/core/src/lib/layout/components/header/header.component.spec.ts index 55ae41fe69..e6915b4b04 100644 --- a/lib/core/src/lib/layout/components/header/header.component.spec.ts +++ b/lib/core/src/lib/layout/components/header/header.component.spec.ts @@ -17,11 +17,11 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { HeaderLayoutComponent } from './header.component'; -import { CoreTestingModule } from '../../../testing/core.testing.module'; import { Component } from '@angular/core'; import { HarnessLoader } from '@angular/cdk/testing'; import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed'; import { UnitTestingUtils } from '../../../testing/unit-testing-utils'; +import { provideRouter } from '@angular/router'; describe('HeaderLayoutComponent', () => { let loader: HarnessLoader; @@ -32,7 +32,8 @@ describe('HeaderLayoutComponent', () => { describe('Input parameters', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule, HeaderLayoutComponent] + imports: [HeaderLayoutComponent], + providers: [provideRouter([])] }); fixture = TestBed.createComponent(HeaderLayoutComponent); loader = TestbedHarnessEnvironment.loader(fixture); @@ -248,7 +249,8 @@ describe('HeaderLayoutComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule, HeaderLayoutTesterComponent] + imports: [HeaderLayoutTesterComponent], + providers: [provideRouter([])] }); }); diff --git a/lib/core/src/lib/layout/components/sidebar-action/sidebar-action-menu.component.spec.ts b/lib/core/src/lib/layout/components/sidebar-action/sidebar-action-menu.component.spec.ts index e022f52fea..5f582dbb27 100644 --- a/lib/core/src/lib/layout/components/sidebar-action/sidebar-action-menu.component.spec.ts +++ b/lib/core/src/lib/layout/components/sidebar-action/sidebar-action-menu.component.spec.ts @@ -18,7 +18,6 @@ import { Component } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { SidebarActionMenuComponent } from './sidebar-action-menu.component'; -import { CoreTestingModule } from '../../../testing/core.testing.module'; import { CommonModule } from '@angular/common'; import { MatIconModule } from '@angular/material/icon'; import { MatMenuModule } from '@angular/material/menu'; @@ -31,7 +30,7 @@ describe('SidebarActionMenuComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule, SidebarActionMenuComponent] + imports: [SidebarActionMenuComponent] }); fixture = TestBed.createComponent(SidebarActionMenuComponent); component = fixture.componentInstance; @@ -86,7 +85,7 @@ describe('Custom SidebarActionMenuComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule, SidebarActionMenuComponent, CustomSidebarActionMenuComponent] + imports: [SidebarActionMenuComponent, CustomSidebarActionMenuComponent] }); fixture = TestBed.createComponent(CustomSidebarActionMenuComponent); fixture.detectChanges(); diff --git a/lib/core/src/lib/login/components/login-dialog-panel/login-dialog-panel.component.spec.ts b/lib/core/src/lib/login/components/login-dialog-panel/login-dialog-panel.component.spec.ts index 1cb33f4488..d0ac796dc4 100644 --- a/lib/core/src/lib/login/components/login-dialog-panel/login-dialog-panel.component.spec.ts +++ b/lib/core/src/lib/login/components/login-dialog-panel/login-dialog-panel.component.spec.ts @@ -21,7 +21,7 @@ import { OidcAuthenticationService } from '../../../auth/oidc/oidc-authenticatio import { UnitTestingUtils } from '../../../testing/unit-testing-utils'; import { LoginDialogPanelComponent } from './login-dialog-panel.component'; import { BasicAlfrescoAuthService } from '../../../auth/basic-auth/basic-alfresco-auth.service'; -import { CoreTestingModule } from '../../../testing/core.testing.module'; +import { NoopAuthModule } from '@alfresco/adf-core'; describe('LoginDialogPanelComponent', () => { let component: LoginDialogPanelComponent; @@ -33,7 +33,7 @@ describe('LoginDialogPanelComponent', () => { beforeEach(async () => { TestBed.configureTestingModule({ - imports: [CoreTestingModule], + imports: [NoopAuthModule, LoginDialogPanelComponent], providers: [{ provide: OidcAuthenticationService, useValue: {} }] }); fixture = TestBed.createComponent(LoginDialogPanelComponent); diff --git a/lib/core/src/lib/login/components/login/login.component.spec.ts b/lib/core/src/lib/login/components/login/login.component.spec.ts index 1a1fa29f06..c12db67a6e 100644 --- a/lib/core/src/lib/login/components/login/login.component.spec.ts +++ b/lib/core/src/lib/login/components/login/login.component.spec.ts @@ -26,9 +26,12 @@ import { UserPreferencesService } from '../../../common/services/user-preference import { AppConfigService } from '../../../app-config/app-config.service'; import { BasicAlfrescoAuthService } from '../../../auth/basic-auth/basic-alfresco-auth.service'; import { UnitTestingUtils } from '../../../testing/unit-testing-utils'; -import { CoreTestingModule } from '../../../testing/core.testing.module'; import { LoginSuccessEvent } from '../../models/login-success.event'; import { LoginErrorEvent } from '../../models/login-error.event'; +import { provideHttpClientTesting } from '@angular/common/http/testing'; +import { NoopAuthModule } from '../../../testing/noop-auth.module'; +import { TranslationService } from '../../../translation/translation.service'; +import { NoopTranslationService } from '../../../testing/noop-translate.module'; describe('LoginComponent', () => { let component: LoginComponent; @@ -58,8 +61,10 @@ describe('LoginComponent', () => { beforeEach(fakeAsync(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule], + imports: [NoopAuthModule, LoginComponent], providers: [ + provideHttpClientTesting(), + { provide: TranslationService, useClass: NoopTranslationService }, { provide: OidcAuthenticationService, useValue: { diff --git a/lib/core/src/lib/login/directives/login-footer.directive.spec.ts b/lib/core/src/lib/login/directives/login-footer.directive.spec.ts index 50d8e1ea1b..7497227635 100644 --- a/lib/core/src/lib/login/directives/login-footer.directive.spec.ts +++ b/lib/core/src/lib/login/directives/login-footer.directive.spec.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { CoreTestingModule, LoginComponent, LoginFooterDirective } from '@alfresco/adf-core'; +import { LoginComponent, LoginFooterDirective, NoopAuthModule } from '@alfresco/adf-core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { OidcAuthenticationService } from '../../auth/oidc/oidc-authentication.service'; @@ -26,7 +26,7 @@ describe('LoginFooterDirective', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule], + imports: [NoopAuthModule, LoginComponent], providers: [ { provide: OidcAuthenticationService, diff --git a/lib/core/src/lib/login/directives/login-header.directive.spec.ts b/lib/core/src/lib/login/directives/login-header.directive.spec.ts index 357ee21ad6..6407a0035c 100644 --- a/lib/core/src/lib/login/directives/login-header.directive.spec.ts +++ b/lib/core/src/lib/login/directives/login-header.directive.spec.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { CoreTestingModule, LoginComponent, LoginHeaderDirective } from '@alfresco/adf-core'; +import { LoginComponent, LoginHeaderDirective, NoopAuthModule } from '@alfresco/adf-core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { OidcAuthenticationService } from '../../auth/oidc/oidc-authentication.service'; @@ -26,7 +26,7 @@ describe('LoginHeaderDirective', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule], + imports: [NoopAuthModule, LoginComponent], providers: [{ provide: OidcAuthenticationService, useValue: {} }] }); fixture = TestBed.createComponent(LoginComponent); diff --git a/lib/core/src/lib/pagination/infinite-pagination.component.spec.ts b/lib/core/src/lib/pagination/infinite-pagination.component.spec.ts index 3645df4997..a9c1edcf6a 100644 --- a/lib/core/src/lib/pagination/infinite-pagination.component.spec.ts +++ b/lib/core/src/lib/pagination/infinite-pagination.component.spec.ts @@ -20,7 +20,6 @@ import { PaginationModel } from '../models/pagination.model'; import { InfinitePaginationComponent } from './infinite-pagination.component'; import { PaginatedComponent } from './paginated-component.interface'; import { BehaviorSubject } from 'rxjs'; -import { CoreTestingModule } from '../testing/core.testing.module'; import { Component, ChangeDetectorRef } from '@angular/core'; import { RequestPaginationModel } from '../models/request-pagination.model'; import { UnitTestingUtils } from '../testing/unit-testing-utils'; @@ -59,7 +58,7 @@ describe('InfinitePaginationComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule, TestPaginatedComponent] + imports: [TestPaginatedComponent] }); fixture = TestBed.createComponent(InfinitePaginationComponent); component = fixture.componentInstance; diff --git a/lib/core/src/lib/pipes/decimal-number.pipe.spec.ts b/lib/core/src/lib/pipes/decimal-number.pipe.spec.ts index 8ef46e235a..62ece4f0ec 100644 --- a/lib/core/src/lib/pipes/decimal-number.pipe.spec.ts +++ b/lib/core/src/lib/pipes/decimal-number.pipe.spec.ts @@ -18,7 +18,6 @@ import { TestBed } from '@angular/core/testing'; import { UserPreferencesService } from '../common/services/user-preferences.service'; import { of } from 'rxjs'; -import { CoreTestingModule } from '../testing/core.testing.module'; import { DecimalNumberPipe } from './decimal-number.pipe'; import { Injector, runInInjectionContext } from '@angular/core'; import { AppConfigService } from '@alfresco/adf-core'; @@ -28,9 +27,6 @@ describe('DecimalNumberPipe', () => { let userPreferences: UserPreferencesService; beforeEach(() => { - TestBed.configureTestingModule({ - imports: [CoreTestingModule] - }); userPreferences = TestBed.inject(UserPreferencesService); const injector = TestBed.inject(Injector); spyOn(userPreferences, 'select').and.returnValue(of('')); diff --git a/lib/core/src/lib/pipes/localized-date.pipe.spec.ts b/lib/core/src/lib/pipes/localized-date.pipe.spec.ts index ab22aacca6..6ff68d2030 100644 --- a/lib/core/src/lib/pipes/localized-date.pipe.spec.ts +++ b/lib/core/src/lib/pipes/localized-date.pipe.spec.ts @@ -20,7 +20,6 @@ import { TestBed } from '@angular/core/testing'; import { AppConfigService } from '../app-config/app-config.service'; import { UserPreferencesService } from '../common/services/user-preferences.service'; import { of } from 'rxjs'; -import { CoreTestingModule } from '../testing/core.testing.module'; import { registerLocaleData } from '@angular/common'; import localeFr from '@angular/common/locales/fr'; registerLocaleData(localeFr); @@ -30,9 +29,6 @@ describe('LocalizedDatePipe', () => { let userPreferences: UserPreferencesService; beforeEach(() => { - TestBed.configureTestingModule({ - imports: [CoreTestingModule] - }); userPreferences = TestBed.inject(UserPreferencesService); spyOn(userPreferences, 'select').and.returnValue(of('')); pipe = new LocalizedDatePipe(userPreferences, TestBed.inject(AppConfigService)); diff --git a/lib/core/src/lib/pipes/multi-value.pipe.spec.ts b/lib/core/src/lib/pipes/multi-value.pipe.spec.ts index 8f5227912b..3c148978e7 100644 --- a/lib/core/src/lib/pipes/multi-value.pipe.spec.ts +++ b/lib/core/src/lib/pipes/multi-value.pipe.spec.ts @@ -17,14 +17,13 @@ import { MultiValuePipe } from './multi-value.pipe'; import { TestBed } from '@angular/core/testing'; -import { CoreTestingModule } from '../testing/core.testing.module'; describe('MultiValuePipe', () => { let pipe: MultiValuePipe; beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule, MultiValuePipe], + imports: [MultiValuePipe], providers: [MultiValuePipe] }); pipe = TestBed.inject(MultiValuePipe); diff --git a/lib/core/src/lib/pipes/time-ago.pipe.spec.ts b/lib/core/src/lib/pipes/time-ago.pipe.spec.ts index f55d6cfd83..8b7fe09744 100644 --- a/lib/core/src/lib/pipes/time-ago.pipe.spec.ts +++ b/lib/core/src/lib/pipes/time-ago.pipe.spec.ts @@ -19,7 +19,6 @@ import { TimeAgoPipe } from './time-ago.pipe'; import { TestBed } from '@angular/core/testing'; import { AppConfigService } from '../app-config/app-config.service'; import { UserPreferencesService } from '../common/services/user-preferences.service'; -import { CoreTestingModule } from '../testing/core.testing.module'; import { of } from 'rxjs'; import { Injector, runInInjectionContext } from '@angular/core'; @@ -28,9 +27,6 @@ describe('TimeAgoPipe', () => { let userPreferences: UserPreferencesService; beforeEach(() => { - TestBed.configureTestingModule({ - imports: [CoreTestingModule] - }); userPreferences = TestBed.inject(UserPreferencesService); const injector = TestBed.inject(Injector); spyOn(userPreferences, 'select').and.returnValue(of('')); diff --git a/lib/core/src/lib/pipes/truncate.pipe.spec.ts b/lib/core/src/lib/pipes/truncate.pipe.spec.ts index 89a6e5c6fd..6fa108831e 100644 --- a/lib/core/src/lib/pipes/truncate.pipe.spec.ts +++ b/lib/core/src/lib/pipes/truncate.pipe.spec.ts @@ -17,16 +17,12 @@ import { TruncatePipe } from './truncate.pipe'; import { TestBed } from '@angular/core/testing'; -import { CoreTestingModule } from '../testing/core.testing.module'; import { Injector, runInInjectionContext } from '@angular/core'; describe('TruncatePipe', () => { let pipe: TruncatePipe; beforeEach(() => { - TestBed.configureTestingModule({ - imports: [CoreTestingModule] - }); const injector = TestBed.inject(Injector); runInInjectionContext(injector, () => { pipe = new TruncatePipe(); diff --git a/lib/core/src/lib/search-text/search-text-input.component.spec.ts b/lib/core/src/lib/search-text/search-text-input.component.spec.ts index 500b98a3ea..82088aa2fb 100644 --- a/lib/core/src/lib/search-text/search-text-input.component.spec.ts +++ b/lib/core/src/lib/search-text/search-text-input.component.spec.ts @@ -16,7 +16,6 @@ */ import { ComponentFixture, TestBed, discardPeriodicTasks, fakeAsync, tick } from '@angular/core/testing'; -import { CoreTestingModule } from '../testing/core.testing.module'; import { SearchTextInputComponent } from './search-text-input.component'; import { DebugElement } from '@angular/core'; import { Subject } from 'rxjs'; @@ -32,7 +31,7 @@ describe('SearchTextInputComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule] + imports: [SearchTextInputComponent] }); fixture = TestBed.createComponent(SearchTextInputComponent); component = fixture.componentInstance; diff --git a/lib/core/src/lib/snackbar-content/snackbar-content.component.spec.ts b/lib/core/src/lib/snackbar-content/snackbar-content.component.spec.ts index 1ff5695027..5db3d7b45c 100644 --- a/lib/core/src/lib/snackbar-content/snackbar-content.component.spec.ts +++ b/lib/core/src/lib/snackbar-content/snackbar-content.component.spec.ts @@ -20,7 +20,6 @@ import { MatIcon } from '@angular/material/icon'; import { MAT_SNACK_BAR_DATA, MatSnackBarRef } from '@angular/material/snack-bar'; import { SnackbarContentComponent } from './snackbar-content.component'; import { UnitTestingUtils } from '../testing/unit-testing-utils'; -import { CoreTestingModule } from '../testing/core.testing.module'; describe('SnackbarContentComponent', () => { let component: SnackbarContentComponent; @@ -29,7 +28,7 @@ describe('SnackbarContentComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule, SnackbarContentComponent], + imports: [SnackbarContentComponent], providers: [ { provide: MatSnackBarRef, diff --git a/lib/core/src/lib/templates/error-content/error-content.component.spec.ts b/lib/core/src/lib/templates/error-content/error-content.component.spec.ts index 2df76ef1b9..7f71b14323 100644 --- a/lib/core/src/lib/templates/error-content/error-content.component.spec.ts +++ b/lib/core/src/lib/templates/error-content/error-content.component.spec.ts @@ -16,7 +16,6 @@ */ import { TestBed, ComponentFixture } from '@angular/core/testing'; -import { CoreTestingModule } from '../../testing/core.testing.module'; import { ErrorContentComponent } from './error-content.component'; import { TranslationService } from '../../translation/translation.service'; import { ActivatedRoute } from '@angular/router'; @@ -31,7 +30,7 @@ describe('ErrorContentComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule], + imports: [ErrorContentComponent], providers: [{ provide: ActivatedRoute, useValue: { params: of() } }] }); fixture = TestBed.createComponent(ErrorContentComponent); diff --git a/lib/core/src/lib/testing/core.testing.module.ts b/lib/core/src/lib/testing/core.testing.module.ts index ae293cdefb..1c2ec6d92c 100644 --- a/lib/core/src/lib/testing/core.testing.module.ts +++ b/lib/core/src/lib/testing/core.testing.module.ts @@ -21,6 +21,7 @@ import { CoreModule } from '../core.module'; import { NoopTranslateModule } from './noop-translate.module'; import { NoopAuthModule } from './noop-auth.module'; +/** @deprecated this module is deprecated and will be removed in the future */ @NgModule({ imports: [NoopAnimationsModule, CoreModule.forRoot(), NoopTranslateModule, NoopAuthModule] }) diff --git a/lib/core/src/lib/testing/noop-translate.module.ts b/lib/core/src/lib/testing/noop-translate.module.ts index d64e402de7..bd906c7bd8 100644 --- a/lib/core/src/lib/testing/noop-translate.module.ts +++ b/lib/core/src/lib/testing/noop-translate.module.ts @@ -17,7 +17,7 @@ import { EventEmitter, Injectable, NgModule } from '@angular/core'; import { HttpClientTestingModule } from '@angular/common/http/testing'; -import { TranslateModule } from '@ngx-translate/core'; +import { provideTranslateService, TranslateLoader } from '@ngx-translate/core'; import { TranslationService } from '../translation/translation.service'; import { LangChangeEvent } from '../mock'; import { Observable, of } from 'rxjs'; @@ -47,8 +47,15 @@ export class NoopTranslationService implements TranslationService { } @NgModule({ - imports: [HttpClientTestingModule, TranslateModule.forRoot()], - providers: [{ provide: TranslationService, useClass: NoopTranslationService }], - exports: [TranslateModule] + imports: [HttpClientTestingModule], + providers: [ + { provide: TranslationService, useClass: NoopTranslationService }, + provideTranslateService({ + loader: { + provide: TranslateLoader, + useClass: NoopTranslationService + } + }) + ] }) export class NoopTranslateModule {} diff --git a/lib/core/src/lib/translation/translate-loader.service.ts b/lib/core/src/lib/translation/translate-loader.service.ts index f439895fc3..50fd91a4b0 100644 --- a/lib/core/src/lib/translation/translate-loader.service.ts +++ b/lib/core/src/lib/translation/translate-loader.service.ts @@ -29,7 +29,12 @@ import { map, catchError, retry } from 'rxjs/operators'; export class TranslateLoaderService implements TranslateLoader { private prefix: string = 'i18n'; private suffix: string = '.json'; - private providers: ComponentTranslationModel[] = []; + private providers: ComponentTranslationModel[] = [ + new ComponentTranslationModel({ + name: 'adf-core', + path: 'assets/adf-core' + }) + ]; private queue: string[][] = []; private defaultLang: string = 'en'; diff --git a/lib/core/src/lib/translation/translate-loader.spec.ts b/lib/core/src/lib/translation/translate-loader.spec.ts index c3525703ac..a6bfaaac99 100644 --- a/lib/core/src/lib/translation/translate-loader.spec.ts +++ b/lib/core/src/lib/translation/translate-loader.spec.ts @@ -18,11 +18,8 @@ import { TestBed } from '@angular/core/testing'; import { TranslateLoaderService } from './translate-loader.service'; import { TranslationService } from './translation.service'; -import { TranslateModule } from '@ngx-translate/core'; -import { CoreModule } from '../core.module'; -import { AuthModule } from '../auth/oidc/auth.module'; - -declare let jasmine: any; +import { provideTranslateService, TranslateLoader } from '@ngx-translate/core'; +import { HttpClient } from '@angular/common/http'; describe('TranslateLoader', () => { let translationService: TranslationService; @@ -30,17 +27,20 @@ describe('TranslateLoader', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [AuthModule.forRoot({ useHash: true }), TranslateModule.forRoot(), CoreModule.forRoot()], - providers: [TranslationService] + providers: [ + provideTranslateService({ + loader: { + provide: TranslateLoader, + useClass: TranslateLoaderService, + deps: [HttpClient] + }, + defaultLanguage: 'en' + }), + TranslationService + ] }); translationService = TestBed.inject(TranslationService); customLoader = translationService.translate.currentLoader as TranslateLoaderService; - - jasmine.Ajax.install(); - }); - - afterEach(() => { - jasmine.Ajax.uninstall(); }); it('should be able to provide any TranslateLoader', () => { diff --git a/lib/core/src/lib/viewer/components/download-prompt-dialog/download-prompt-dialog.component.spec.ts b/lib/core/src/lib/viewer/components/download-prompt-dialog/download-prompt-dialog.component.spec.ts index c849c012f6..deaec9e869 100644 --- a/lib/core/src/lib/viewer/components/download-prompt-dialog/download-prompt-dialog.component.spec.ts +++ b/lib/core/src/lib/viewer/components/download-prompt-dialog/download-prompt-dialog.component.spec.ts @@ -17,7 +17,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { MatDialogRef } from '@angular/material/dialog'; -import { CoreTestingModule, UnitTestingUtils } from '../../../testing'; +import { UnitTestingUtils } from '../../../testing'; import { DownloadPromptActions } from '../../models/download-prompt.actions'; import { DownloadPromptDialogComponent } from './download-prompt-dialog.component'; @@ -34,7 +34,7 @@ describe('DownloadPromptDialogComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule, DownloadPromptDialogComponent], + imports: [DownloadPromptDialogComponent], providers: [{ provide: MatDialogRef, useValue: mockDialog }] }); matDialogRef = TestBed.inject(MatDialogRef); diff --git a/lib/core/src/lib/viewer/components/img-viewer/img-viewer.component.spec.ts b/lib/core/src/lib/viewer/components/img-viewer/img-viewer.component.spec.ts index 6e47d40526..a3e46bd95f 100644 --- a/lib/core/src/lib/viewer/components/img-viewer/img-viewer.component.spec.ts +++ b/lib/core/src/lib/viewer/components/img-viewer/img-viewer.component.spec.ts @@ -19,7 +19,7 @@ import { SimpleChange } from '@angular/core'; import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing'; import { AppConfigService } from '../../../app-config'; import { UrlService } from '../../../common'; -import { CoreTestingModule, UnitTestingUtils } from '../../../testing'; +import { UnitTestingUtils } from '../../../testing'; import { ImgViewerComponent } from './img-viewer.component'; describe('Test Img viewer component ', () => { @@ -33,12 +33,6 @@ describe('Test Img viewer component ', () => { return new Blob([data], { type: 'image/png' }); }; - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [CoreTestingModule] - }); - }); - describe('Zoom customization', () => { beforeEach(() => { urlService = TestBed.inject(UrlService); diff --git a/lib/core/src/lib/viewer/components/pdf-viewer-password-dialog/pdf-viewer-password-dialog.spec.ts b/lib/core/src/lib/viewer/components/pdf-viewer-password-dialog/pdf-viewer-password-dialog.spec.ts index 6a290510dc..5822435122 100644 --- a/lib/core/src/lib/viewer/components/pdf-viewer-password-dialog/pdf-viewer-password-dialog.spec.ts +++ b/lib/core/src/lib/viewer/components/pdf-viewer-password-dialog/pdf-viewer-password-dialog.spec.ts @@ -17,7 +17,6 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; -import { CoreTestingModule } from '../../../testing'; import { PdfPasswordDialogComponent } from './pdf-viewer-password-dialog'; declare const pdfjsLib: any; @@ -29,7 +28,7 @@ describe('PdfPasswordDialogComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule], + imports: [PdfPasswordDialogComponent], providers: [ { provide: MAT_DIALOG_DATA, diff --git a/lib/core/src/lib/viewer/components/pdf-viewer-thumb/pdf-viewer-thumb.component.spec.ts b/lib/core/src/lib/viewer/components/pdf-viewer-thumb/pdf-viewer-thumb.component.spec.ts index 1ff2e68996..c7bd91e69e 100644 --- a/lib/core/src/lib/viewer/components/pdf-viewer-thumb/pdf-viewer-thumb.component.spec.ts +++ b/lib/core/src/lib/viewer/components/pdf-viewer-thumb/pdf-viewer-thumb.component.spec.ts @@ -18,7 +18,6 @@ import { DomSanitizer } from '@angular/platform-browser'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { PdfThumbComponent } from './pdf-viewer-thumb.component'; -import { CoreTestingModule } from '../../../testing'; describe('PdfThumbComponent', () => { let fixture: ComponentFixture; @@ -42,7 +41,7 @@ describe('PdfThumbComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule], + imports: [PdfThumbComponent], providers: [ { provide: DomSanitizer, diff --git a/lib/core/src/lib/viewer/components/pdf-viewer-thumbnails/pdf-viewer-thumbnails.component.spec.ts b/lib/core/src/lib/viewer/components/pdf-viewer-thumbnails/pdf-viewer-thumbnails.component.spec.ts index e0d79e4cb2..b041637301 100644 --- a/lib/core/src/lib/viewer/components/pdf-viewer-thumbnails/pdf-viewer-thumbnails.component.spec.ts +++ b/lib/core/src/lib/viewer/components/pdf-viewer-thumbnails/pdf-viewer-thumbnails.component.spec.ts @@ -17,7 +17,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { PdfThumbListComponent } from './pdf-viewer-thumbnails.component'; -import { CoreTestingModule, UnitTestingUtils } from '../../../testing'; +import { UnitTestingUtils } from '../../../testing'; import { DOWN_ARROW, ESCAPE, UP_ARROW } from '@angular/cdk/keycodes'; declare const pdfjsViewer: any; @@ -72,7 +72,7 @@ describe('PdfThumbListComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule] + imports: [PdfThumbListComponent] }); fixture = TestBed.createComponent(PdfThumbListComponent); testingUtils = new UnitTestingUtils(fixture.debugElement); diff --git a/lib/core/src/lib/viewer/components/txt-viewer/txt-viewer.component.spec.ts b/lib/core/src/lib/viewer/components/txt-viewer/txt-viewer.component.spec.ts index 9028f62c48..6e4db6dbd0 100644 --- a/lib/core/src/lib/viewer/components/txt-viewer/txt-viewer.component.spec.ts +++ b/lib/core/src/lib/viewer/components/txt-viewer/txt-viewer.component.spec.ts @@ -18,7 +18,7 @@ import { SimpleChange } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { TxtViewerComponent } from './txt-viewer.component'; -import { CoreTestingModule, UnitTestingUtils } from '../../../testing'; +import { UnitTestingUtils } from '../../../testing'; import { HttpClient } from '@angular/common/http'; import { of } from 'rxjs'; @@ -29,7 +29,7 @@ describe('Text View component', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule, TxtViewerComponent] + imports: [TxtViewerComponent] }); fixture = TestBed.createComponent(TxtViewerComponent); testingUtils = new UnitTestingUtils(fixture.debugElement); diff --git a/lib/core/src/lib/viewer/components/unknown-format/unknown-format.component.spec.ts b/lib/core/src/lib/viewer/components/unknown-format/unknown-format.component.spec.ts index 6fcccd8a85..d3f38fcc7d 100644 --- a/lib/core/src/lib/viewer/components/unknown-format/unknown-format.component.spec.ts +++ b/lib/core/src/lib/viewer/components/unknown-format/unknown-format.component.spec.ts @@ -17,7 +17,6 @@ import { UnknownFormatComponent } from './unknown-format.component'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { CoreTestingModule } from '@alfresco/adf-core'; describe('Unknown Format Component', () => { let fixture: ComponentFixture; @@ -26,7 +25,7 @@ describe('Unknown Format Component', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule] + imports: [UnknownFormatComponent] }); fixture = TestBed.createComponent(UnknownFormatComponent); fixture.detectChanges(); diff --git a/lib/core/src/lib/viewer/components/viewer.component.spec.ts b/lib/core/src/lib/viewer/components/viewer.component.spec.ts index 7b2f68cc3e..986fb49cd6 100644 --- a/lib/core/src/lib/viewer/components/viewer.component.spec.ts +++ b/lib/core/src/lib/viewer/components/viewer.component.spec.ts @@ -17,13 +17,11 @@ import { Component, DebugElement, SimpleChanges } from '@angular/core'; import { ComponentFixture, discardPeriodicTasks, fakeAsync, flush, TestBed, tick } from '@angular/core/testing'; -import { MatButtonModule } from '@angular/material/button'; import { MatDialog } from '@angular/material/dialog'; -import { MatIconModule } from '@angular/material/icon'; import { of } from 'rxjs'; import { AppConfigService } from '../../app-config'; import { EventMock } from '../../mock'; -import { CoreTestingModule, UnitTestingUtils } from '../../testing'; +import { UnitTestingUtils } from '../../testing'; import { DownloadPromptActions } from '../models/download-prompt.actions'; import { CloseButtonPosition } from '../models/viewer.model'; import { ViewUtilService } from '../services/view-util.service'; @@ -58,9 +56,6 @@ describe('ViewerComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ imports: [ - CoreTestingModule, - MatButtonModule, - MatIconModule, ViewerWithCustomToolbarComponent, ViewerWithCustomSidebarComponent, ViewerWithCustomOpenWithComponent, diff --git a/lib/core/src/lib/viewer/directives/viewer-extension.directive.spec.ts b/lib/core/src/lib/viewer/directives/viewer-extension.directive.spec.ts index bf3adf7b8b..a664bd4c96 100644 --- a/lib/core/src/lib/viewer/directives/viewer-extension.directive.spec.ts +++ b/lib/core/src/lib/viewer/directives/viewer-extension.directive.spec.ts @@ -21,7 +21,6 @@ import { ChangeDetectorRef, ElementRef } from '@angular/core'; import { TestBed } from '@angular/core/testing'; import { ViewerRenderComponent } from '../components/viewer-render/viewer-render.component'; import { ViewerExtensionDirective } from './viewer-extension.directive'; -import { CoreTestingModule } from '../../testing'; describe('ExtensionViewerDirective', () => { let extensionViewerDirective: ViewerExtensionDirective; @@ -35,7 +34,7 @@ describe('ExtensionViewerDirective', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule], + imports: [ViewerRenderComponent], providers: [ { provide: Location, useClass: SpyLocation }, ViewerExtensionDirective, diff --git a/lib/process-services-cloud/src/lib/app/components/app-details-cloud/app-details-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/app/components/app-details-cloud/app-details-cloud.component.spec.ts index 726f2f1c4e..e9193787df 100644 --- a/lib/process-services-cloud/src/lib/app/components/app-details-cloud/app-details-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/app/components/app-details-cloud/app-details-cloud.component.spec.ts @@ -18,8 +18,8 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { fakeApplicationInstance } from '../../mock/app-model.mock'; import { AppDetailsCloudComponent } from './app-details-cloud.component'; -import { ProcessServiceCloudTestingModule } from '../../../testing/process-service-cloud.testing.module'; import { DEFAULT_APP_INSTANCE_THEME } from '../../models/application-instance.model'; +import { NoopTranslateModule } from '@alfresco/adf-core'; describe('AppDetailsCloudComponent', () => { let component: AppDetailsCloudComponent; @@ -28,7 +28,7 @@ describe('AppDetailsCloudComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule, AppDetailsCloudComponent] + imports: [NoopTranslateModule, AppDetailsCloudComponent] }); fixture = TestBed.createComponent(AppDetailsCloudComponent); component = fixture.componentInstance; diff --git a/lib/process-services-cloud/src/lib/app/components/app-list-cloud/app-list-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/app/components/app-list-cloud/app-list-cloud.component.spec.ts index 101f93c42b..28dfe30ee9 100644 --- a/lib/process-services-cloud/src/lib/app/components/app-list-cloud/app-list-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/app/components/app-list-cloud/app-list-cloud.component.spec.ts @@ -22,9 +22,8 @@ import { of, throwError } from 'rxjs'; import { fakeApplicationInstance } from '../../mock/app-model.mock'; import { AppListCloudComponent, LAYOUT_GRID, LAYOUT_LIST } from './app-list-cloud.component'; import { AppsProcessCloudService } from '../../services/apps-process-cloud.service'; -import { ProcessServiceCloudTestingModule } from '../../../testing/process-service-cloud.testing.module'; import { MatIconModule } from '@angular/material/icon'; -import { CustomEmptyContentTemplateDirective } from '@alfresco/adf-core'; +import { CustomEmptyContentTemplateDirective, NoopTranslateModule } from '@alfresco/adf-core'; describe('AppListCloudComponent', () => { let component: AppListCloudComponent; @@ -56,7 +55,7 @@ describe('AppListCloudComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule, AppListCloudComponent, CustomEmptyAppListCloudTemplateComponent] + imports: [NoopTranslateModule, AppListCloudComponent, CustomEmptyAppListCloudTemplateComponent] }); fixture = TestBed.createComponent(AppListCloudComponent); component = fixture.componentInstance; diff --git a/lib/process-services-cloud/src/lib/app/services/apps-process-cloud.service.spec.ts b/lib/process-services-cloud/src/lib/app/services/apps-process-cloud.service.spec.ts index 31dbaf6e79..6d903a378f 100644 --- a/lib/process-services-cloud/src/lib/app/services/apps-process-cloud.service.spec.ts +++ b/lib/process-services-cloud/src/lib/app/services/apps-process-cloud.service.spec.ts @@ -18,11 +18,10 @@ import { TestBed } from '@angular/core/testing'; import { throwError } from 'rxjs'; import { AlfrescoApiService } from '@alfresco/adf-content-services'; -import { AppConfigService, CoreTestingModule } from '@alfresco/adf-core'; -import { HttpErrorResponse } from '@angular/common/http'; +import { AppConfigService } from '@alfresco/adf-core'; +import { HttpErrorResponse, provideHttpClient } from '@angular/common/http'; import { AppsProcessCloudService } from './apps-process-cloud.service'; import { fakeApplicationInstance, fakeApplicationInstanceWithEnvironment } from '../mock/app-model.mock'; -import { ProcessServiceCloudTestingModule } from '../../testing/process-service-cloud.testing.module'; import { fakeEnvironmentList } from '../../common/mock/environment.mock'; import { AdfHttpClient } from '@alfresco/adf-core/api'; @@ -37,8 +36,7 @@ describe('AppsProcessCloudService', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule, ProcessServiceCloudTestingModule], - providers: [AlfrescoApiService, AppConfigService] + providers: [provideHttpClient(), AlfrescoApiService, AppConfigService] }); adfHttpClient = TestBed.inject(AdfHttpClient); spyOn(adfHttpClient, 'request').and.returnValue(apiMockResponse); diff --git a/lib/process-services-cloud/src/lib/common/date-range-filter/date-range-filter.component.spec.ts b/lib/process-services-cloud/src/lib/common/date-range-filter/date-range-filter.component.spec.ts index a1bedd6aa8..a5a60633f6 100644 --- a/lib/process-services-cloud/src/lib/common/date-range-filter/date-range-filter.component.spec.ts +++ b/lib/process-services-cloud/src/lib/common/date-range-filter/date-range-filter.component.spec.ts @@ -17,7 +17,6 @@ import { DateRangeFilterComponent } from './date-range-filter.component'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { ProcessServiceCloudTestingModule } from '../../testing/process-service-cloud.testing.module'; import { MatSelectChange } from '@angular/material/select'; import { DateCloudFilterType } from '../../models/date-cloud-filter.model'; import { DateRangeFilterService } from './date-range-filter.service'; @@ -28,6 +27,7 @@ import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed'; import { MatSelectHarness } from '@angular/material/select/testing'; import { MatFormFieldHarness } from '@angular/material/form-field/testing'; import { MatDateRangeInputHarness } from '@angular/material/datepicker/testing'; +import { NoopTranslateModule } from '@alfresco/adf-core'; describe('DateRangeFilterComponent', () => { let component: DateRangeFilterComponent; @@ -37,7 +37,7 @@ describe('DateRangeFilterComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule, DateRangeFilterComponent] + imports: [NoopTranslateModule, DateRangeFilterComponent] }); fixture = TestBed.createComponent(DateRangeFilterComponent); component = fixture.componentInstance; diff --git a/lib/process-services-cloud/src/lib/form/components/form-cloud-custom-outcomes.component.spec.ts b/lib/process-services-cloud/src/lib/form/components/form-cloud-custom-outcomes.component.spec.ts index adc30c9ae1..2eef535cd8 100644 --- a/lib/process-services-cloud/src/lib/form/components/form-cloud-custom-outcomes.component.spec.ts +++ b/lib/process-services-cloud/src/lib/form/components/form-cloud-custom-outcomes.component.spec.ts @@ -15,11 +15,10 @@ * limitations under the License. */ -import { FormModel } from '@alfresco/adf-core'; +import { FormModel, NoopTranslateModule } from '@alfresco/adf-core'; import { Component, DebugElement, ViewChild } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; -import { ProcessServiceCloudTestingModule } from '../../testing/process-service-cloud.testing.module'; import { FormCloudComponent } from './form-cloud.component'; import { FormCustomOutcomesComponent } from './form-cloud-custom-outcomes.component'; import { MatButtonModule } from '@angular/material/button'; @@ -49,7 +48,7 @@ describe('FormCloudWithCustomOutComesComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule, FormCloudWithCustomOutComesComponent] + imports: [NoopTranslateModule, FormCloudWithCustomOutComesComponent] }); fixture = TestBed.createComponent(FormCloudWithCustomOutComesComponent); customComponent = fixture.componentInstance; diff --git a/lib/process-services-cloud/src/lib/form/components/form-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/form/components/form-cloud.component.spec.ts index 059876a8b2..6c17dfb6da 100644 --- a/lib/process-services-cloud/src/lib/form/components/form-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/form/components/form-cloud.component.spec.ts @@ -45,7 +45,6 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { MatDialog } from '@angular/material/dialog'; import { MatDialogHarness } from '@angular/material/dialog/testing'; import { By } from '@angular/platform-browser'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { TranslateLoader, TranslateService, provideTranslateService } from '@ngx-translate/core'; import { Observable, of, throwError } from 'rxjs'; import { @@ -64,7 +63,6 @@ import { FORM_CLOUD_FIELD_VALIDATORS_TOKEN, FormCloudComponent } from './form-cl import { MatButtonHarness } from '@angular/material/button/testing'; import { FormCloudDisplayMode } from '../../services/form-fields.interfaces'; import { CloudFormRenderingService } from './cloud-form-rendering.service'; -import { ProcessServiceCloudTestingModule } from '../../testing/process-service-cloud.testing.module'; import { TaskVariableCloud } from '../models/task-variable-cloud.model'; const mockOauth2Auth: any = { @@ -114,7 +112,7 @@ describe('FormCloudComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule, FormCloudComponent], + imports: [NoopTranslateModule, NoopAuthModule, FormCloudComponent], providers: [ { provide: VersionCompatibilityService, @@ -1541,7 +1539,7 @@ describe('Multilingual Form', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [NoopAnimationsModule, NoopAuthModule], + imports: [NoopAuthModule], providers: [ provideTranslateService({ loader: { @@ -1616,7 +1614,7 @@ describe('retrieve metadata on submit', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [AuthModule.forRoot({ useHash: true }), NoopAnimationsModule, NoopTranslateModule, CoreModule.forRoot(), FormCloudComponent], + imports: [AuthModule.forRoot({ useHash: true }), CoreModule.forRoot(), FormCloudComponent], providers: [ provideTranslations('app', 'resources'), { diff --git a/lib/process-services-cloud/src/lib/form/components/form-definition-selector-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/form/components/form-definition-selector-cloud.component.spec.ts index e733da7735..3d76891b92 100644 --- a/lib/process-services-cloud/src/lib/form/components/form-definition-selector-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/form/components/form-definition-selector-cloud.component.spec.ts @@ -16,13 +16,13 @@ */ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { ProcessServiceCloudTestingModule } from '../../testing/process-service-cloud.testing.module'; import { FormDefinitionSelectorCloudComponent } from './form-definition-selector-cloud.component'; import { of } from 'rxjs'; import { FormDefinitionSelectorCloudService } from '../services/form-definition-selector-cloud.service'; import { HarnessLoader } from '@angular/cdk/testing'; import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed'; import { MatSelectHarness } from '@angular/material/select/testing'; +import { NoopTranslateModule } from '@alfresco/adf-core'; describe('FormDefinitionCloudComponent', () => { let fixture: ComponentFixture; @@ -32,7 +32,7 @@ describe('FormDefinitionCloudComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule, FormDefinitionSelectorCloudComponent] + imports: [NoopTranslateModule, FormDefinitionSelectorCloudComponent] }); fixture = TestBed.createComponent(FormDefinitionSelectorCloudComponent); service = TestBed.inject(FormDefinitionSelectorCloudService); diff --git a/lib/process-services-cloud/src/lib/form/components/widgets/attach-file/attach-file-cloud-widget.component.spec.ts b/lib/process-services-cloud/src/lib/form/components/widgets/attach-file/attach-file-cloud-widget.component.spec.ts index f48d71ec16..49a9f8f58b 100644 --- a/lib/process-services-cloud/src/lib/form/components/widgets/attach-file/attach-file-cloud-widget.component.spec.ts +++ b/lib/process-services-cloud/src/lib/form/components/widgets/attach-file/attach-file-cloud-widget.component.spec.ts @@ -29,7 +29,9 @@ import { FormService, LocalizedDatePipe, NotificationService, - UploadWidgetContentLinkModel + UploadWidgetContentLinkModel, + NoopTranslateModule, + NoopAuthModule } from '@alfresco/adf-core'; import { allSourceParams, @@ -59,9 +61,14 @@ import { onlyLocalParams, processVariables } from '../../../mocks/attach-file-cloud-widget.mock'; -import { ProcessServiceCloudTestingModule } from '../../../../testing/process-service-cloud.testing.module'; import { Injector, runInInjectionContext } from '@angular/core'; -import { ContentNodeSelectorPanelService, NewVersionUploaderDataAction, NewVersionUploaderService } from '@alfresco/adf-content-services'; +import { + ContentNodeSelectorPanelService, + NewVersionUploaderDataAction, + NewVersionUploaderService, + AlfrescoApiService, + AlfrescoApiServiceMock +} from '@alfresco/adf-content-services'; import { By } from '@angular/platform-browser'; import { of, throwError } from 'rxjs'; @@ -143,7 +150,8 @@ describe('AttachFileCloudWidgetComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule, AttachFileCloudWidgetComponent] + imports: [NoopTranslateModule, NoopAuthModule, AttachFileCloudWidgetComponent], + providers: [{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }] }); notificationService = TestBed.inject(NotificationService); downloadService = TestBed.inject(DownloadService); diff --git a/lib/process-services-cloud/src/lib/form/components/widgets/attach-file/file-properties-table/file-properties-table-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/form/components/widgets/attach-file/file-properties-table/file-properties-table-cloud.component.spec.ts index 77b494b4c5..732573fb7a 100644 --- a/lib/process-services-cloud/src/lib/form/components/widgets/attach-file/file-properties-table/file-properties-table-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/form/components/widgets/attach-file/file-properties-table/file-properties-table-cloud.component.spec.ts @@ -17,9 +17,9 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { ProcessServiceCloudTestingModule } from '../../../../../testing/process-service-cloud.testing.module'; import { FilePropertiesTableCloudComponent } from './file-properties-table-cloud.component'; import { By } from '@angular/platform-browser'; +import { NoopTranslateModule } from '@alfresco/adf-core'; describe('FilePropertiesTableCloudComponent', () => { let widget: FilePropertiesTableCloudComponent; @@ -27,7 +27,7 @@ describe('FilePropertiesTableCloudComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule, FilePropertiesTableCloudComponent] + imports: [NoopTranslateModule, FilePropertiesTableCloudComponent] }); }); diff --git a/lib/process-services-cloud/src/lib/form/components/widgets/data-table/data-table.widget.spec.ts b/lib/process-services-cloud/src/lib/form/components/widgets/data-table/data-table.widget.spec.ts index 0628b34fcd..e3d472e77c 100644 --- a/lib/process-services-cloud/src/lib/form/components/widgets/data-table/data-table.widget.spec.ts +++ b/lib/process-services-cloud/src/lib/form/components/widgets/data-table/data-table.widget.spec.ts @@ -19,7 +19,6 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { DataColumn, DataRow, FormFieldModel, FormFieldTypes, FormModel, FormService, ObjectDataRow, VariableConfig } from '@alfresco/adf-core'; import { By } from '@angular/platform-browser'; import { DataTableWidgetComponent } from './data-table.widget'; -import { ProcessServiceCloudTestingModule } from '../../../../testing/process-service-cloud.testing.module'; import { TaskVariableCloud } from '../../../models/task-variable-cloud.model'; import { FormCloudService } from '../../../services/form-cloud.service'; import { @@ -85,9 +84,6 @@ describe('DataTableWidgetComponent', () => { }; beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule] - }); fixture = TestBed.createComponent(DataTableWidgetComponent); widget = fixture.componentInstance; diff --git a/lib/process-services-cloud/src/lib/form/components/widgets/date/date-cloud.widget.spec.ts b/lib/process-services-cloud/src/lib/form/components/widgets/date/date-cloud.widget.spec.ts index efdd4de185..e580266dd3 100644 --- a/lib/process-services-cloud/src/lib/form/components/widgets/date/date-cloud.widget.spec.ts +++ b/lib/process-services-cloud/src/lib/form/components/widgets/date/date-cloud.widget.spec.ts @@ -17,11 +17,9 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { DateCloudWidgetComponent } from './date-cloud.widget'; -import { FormFieldModel, FormModel, FormFieldTypes, DEFAULT_DATE_FORMAT } from '@alfresco/adf-core'; -import { ProcessServiceCloudTestingModule } from '../../../../testing/process-service-cloud.testing.module'; +import { FormFieldModel, FormModel, FormFieldTypes, DEFAULT_DATE_FORMAT, UnitTestingUtils } from '@alfresco/adf-core'; import { DateAdapter } from '@angular/material/core'; import { isEqual, subDays, addDays } from 'date-fns'; -import { UnitTestingUtils } from '../../../../../../../core/src/lib/testing/unit-testing-utils'; import { HarnessLoader } from '@angular/cdk/testing'; import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed'; @@ -36,7 +34,7 @@ describe('DateCloudWidgetComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule] + imports: [DateCloudWidgetComponent] }); form = new FormModel(); diff --git a/lib/process-services-cloud/src/lib/form/components/widgets/display-external-property/display-external-property.widget.spec.ts b/lib/process-services-cloud/src/lib/form/components/widgets/display-external-property/display-external-property.widget.spec.ts index e2c46e8a3c..62a44de2f7 100644 --- a/lib/process-services-cloud/src/lib/form/components/widgets/display-external-property/display-external-property.widget.spec.ts +++ b/lib/process-services-cloud/src/lib/form/components/widgets/display-external-property/display-external-property.widget.spec.ts @@ -15,17 +15,14 @@ * limitations under the License. */ -import { FormService, FormFieldModel, FormModel, FormFieldTypes } from '@alfresco/adf-core'; +import { FormFieldModel, FormModel, FormFieldTypes, UnitTestingUtils } from '@alfresco/adf-core'; import { HarnessLoader } from '@angular/cdk/testing'; import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { ReactiveFormsModule } from '@angular/forms'; import { MatInputHarness } from '@angular/material/input/testing'; import { DisplayExternalPropertyWidgetComponent } from './display-external-property.widget'; import { FormCloudService } from '../../../services/form-cloud.service'; import { By } from '@angular/platform-browser'; -import { ProcessServiceCloudTestingModule } from '../../../../testing/process-service-cloud.testing.module'; -import { UnitTestingUtils } from '../../../../../../../core/src/lib/testing/unit-testing-utils'; describe('DisplayExternalPropertyWidgetComponent', () => { let loader: HarnessLoader; @@ -37,9 +34,8 @@ describe('DisplayExternalPropertyWidgetComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule, ReactiveFormsModule, DisplayExternalPropertyWidgetComponent], - providers: [FormService] - }).compileComponents(); + imports: [DisplayExternalPropertyWidgetComponent] + }); fixture = TestBed.createComponent(DisplayExternalPropertyWidgetComponent); widget = fixture.componentInstance; diff --git a/lib/process-services-cloud/src/lib/form/components/widgets/display-rich-text/display-rich-text.widget.spec.ts b/lib/process-services-cloud/src/lib/form/components/widgets/display-rich-text/display-rich-text.widget.spec.ts index ff31141fa6..b66e698bd4 100644 --- a/lib/process-services-cloud/src/lib/form/components/widgets/display-rich-text/display-rich-text.widget.spec.ts +++ b/lib/process-services-cloud/src/lib/form/components/widgets/display-rich-text/display-rich-text.widget.spec.ts @@ -18,7 +18,6 @@ import { DebugElement } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; -import { CoreTestingModule } from '@alfresco/adf-core'; import { DisplayRichTextWidgetComponent } from './display-rich-text.widget'; describe('DisplayRichTextWidgetComponent', () => { @@ -81,7 +80,7 @@ describe('DisplayRichTextWidgetComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule, DisplayRichTextWidgetComponent] + imports: [DisplayRichTextWidgetComponent] }); fixture = TestBed.createComponent(DisplayRichTextWidgetComponent); widget = fixture.componentInstance; diff --git a/lib/process-services-cloud/src/lib/form/components/widgets/dropdown/dropdown-cloud.widget.spec.ts b/lib/process-services-cloud/src/lib/form/components/widgets/dropdown/dropdown-cloud.widget.spec.ts index d6600df2d6..3a215a220f 100644 --- a/lib/process-services-cloud/src/lib/form/components/widgets/dropdown/dropdown-cloud.widget.spec.ts +++ b/lib/process-services-cloud/src/lib/form/components/widgets/dropdown/dropdown-cloud.widget.spec.ts @@ -19,9 +19,8 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { of, throwError } from 'rxjs'; import { DEFAULT_OPTION, DropdownCloudWidgetComponent } from './dropdown-cloud.widget'; -import { FormFieldModel, FormModel, FormService, FormFieldEvent, FormFieldTypes } from '@alfresco/adf-core'; +import { FormFieldModel, FormModel, FormService, FormFieldEvent, FormFieldTypes, UnitTestingUtils } from '@alfresco/adf-core'; import { FormCloudService } from '../../../services/form-cloud.service'; -import { ProcessServiceCloudTestingModule } from '../../../../testing/process-service-cloud.testing.module'; import { fakeOptionList, filterOptionList, @@ -38,7 +37,6 @@ import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed'; import { MatSelectHarness } from '@angular/material/select/testing'; import { DebugElement } from '@angular/core'; import { FormUtilsService } from '../../../services/form-utils.service'; -import { UnitTestingUtils } from '../../../../../../../core/src/public-api'; describe('DropdownCloudWidgetComponent', () => { let formService: FormService; @@ -52,7 +50,7 @@ describe('DropdownCloudWidgetComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule] + imports: [DropdownCloudWidgetComponent] }); fixture = TestBed.createComponent(DropdownCloudWidgetComponent); widget = fixture.componentInstance; diff --git a/lib/process-services-cloud/src/lib/form/components/widgets/group/group-cloud.widget.spec.ts b/lib/process-services-cloud/src/lib/form/components/widgets/group/group-cloud.widget.spec.ts index 8f2bef8623..d9b87e94a9 100644 --- a/lib/process-services-cloud/src/lib/form/components/widgets/group/group-cloud.widget.spec.ts +++ b/lib/process-services-cloud/src/lib/form/components/widgets/group/group-cloud.widget.spec.ts @@ -15,10 +15,9 @@ * limitations under the License. */ -import { FormFieldModel, FormFieldTypes, FormModel, IdentityGroupModel } from '@alfresco/adf-core'; +import { FormFieldModel, FormFieldTypes, FormModel, IdentityGroupModel, NoopAuthModule, CoreModule } from '@alfresco/adf-core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { GroupCloudWidgetComponent } from './group-cloud.widget'; -import { ProcessServiceCloudTestingModule } from '../../../../testing/process-service-cloud.testing.module'; import { HarnessLoader } from '@angular/cdk/testing'; import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed'; import { MatChipHarness } from '@angular/material/chips/testing'; @@ -31,7 +30,7 @@ describe('GroupCloudWidgetComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule, GroupCloudWidgetComponent] + imports: [CoreModule.forRoot(), NoopAuthModule, GroupCloudWidgetComponent] }); fixture = TestBed.createComponent(GroupCloudWidgetComponent); widget = fixture.componentInstance; diff --git a/lib/process-services-cloud/src/lib/form/components/widgets/people/people-cloud.widget.spec.ts b/lib/process-services-cloud/src/lib/form/components/widgets/people/people-cloud.widget.spec.ts index bf5ba48ba9..c583bc7dae 100644 --- a/lib/process-services-cloud/src/lib/form/components/widgets/people/people-cloud.widget.spec.ts +++ b/lib/process-services-cloud/src/lib/form/components/widgets/people/people-cloud.widget.spec.ts @@ -15,10 +15,9 @@ * limitations under the License. */ -import { FormFieldModel, FormFieldTypes, FormModel, IdentityUserModel } from '@alfresco/adf-core'; +import { FormFieldModel, FormFieldTypes, FormModel, IdentityUserModel, NoopAuthModule, CoreModule } from '@alfresco/adf-core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { PeopleCloudWidgetComponent } from './people-cloud.widget'; -import { ProcessServiceCloudTestingModule } from '../../../../testing/process-service-cloud.testing.module'; import { IdentityUserService } from '../../../../people/services/identity-user.service'; import { mockShepherdsPie, mockYorkshirePudding } from '../../../../people/mock/people-cloud.mock'; import { HarnessLoader } from '@angular/cdk/testing'; @@ -34,7 +33,7 @@ describe('PeopleCloudWidgetComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule, PeopleCloudWidgetComponent] + imports: [CoreModule.forRoot(), NoopAuthModule, PeopleCloudWidgetComponent] }); identityUserService = TestBed.inject(IdentityUserService); fixture = TestBed.createComponent(PeopleCloudWidgetComponent); diff --git a/lib/process-services-cloud/src/lib/form/components/widgets/properties-viewer/properties-viewer-wrapper/properties-viewer.widget.spec.ts b/lib/process-services-cloud/src/lib/form/components/widgets/properties-viewer/properties-viewer-wrapper/properties-viewer.widget.spec.ts index d797ff379b..d06226f904 100644 --- a/lib/process-services-cloud/src/lib/form/components/widgets/properties-viewer/properties-viewer-wrapper/properties-viewer.widget.spec.ts +++ b/lib/process-services-cloud/src/lib/form/components/widgets/properties-viewer/properties-viewer-wrapper/properties-viewer.widget.spec.ts @@ -17,10 +17,10 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { PropertiesViewerWrapperComponent } from './properties-viewer-wrapper.component'; -import { ProcessServiceCloudTestingModule } from '../../../../../testing/process-service-cloud.testing.module'; import { of } from 'rxjs'; import { fakeNodeWithProperties } from '../../../../mocks/attach-file-cloud-widget.mock'; import { NodesApiService, BasicPropertiesService } from '@alfresco/adf-content-services'; +import { NoopAuthModule, NoopTranslateModule } from '@alfresco/adf-core'; describe('PropertiesViewerWidgetComponent', () => { let component: PropertiesViewerWrapperComponent; @@ -29,7 +29,7 @@ describe('PropertiesViewerWidgetComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule, PropertiesViewerWrapperComponent], + imports: [NoopTranslateModule, NoopAuthModule, PropertiesViewerWrapperComponent], providers: [NodesApiService, { provide: BasicPropertiesService, useValue: { getProperties: () => [] } }] }); fixture = TestBed.createComponent(PropertiesViewerWrapperComponent); diff --git a/lib/process-services-cloud/src/lib/form/components/widgets/properties-viewer/properties-viewer.widget.spec.ts b/lib/process-services-cloud/src/lib/form/components/widgets/properties-viewer/properties-viewer.widget.spec.ts index 8e28382144..eef6be50a9 100644 --- a/lib/process-services-cloud/src/lib/form/components/widgets/properties-viewer/properties-viewer.widget.spec.ts +++ b/lib/process-services-cloud/src/lib/form/components/widgets/properties-viewer/properties-viewer.widget.spec.ts @@ -16,9 +16,8 @@ */ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { FormFieldModel, FormModel } from '@alfresco/adf-core'; +import { FormFieldModel, FormModel, NoopTranslateModule, NoopAuthModule } from '@alfresco/adf-core'; import { PropertiesViewerWidgetComponent } from './properties-viewer.widget'; -import { ProcessServiceCloudTestingModule } from '../../../../testing/process-service-cloud.testing.module'; import { fakeNodeWithProperties } from '../../../mocks/attach-file-cloud-widget.mock'; import { NodesApiService, BasicPropertiesService } from '@alfresco/adf-content-services'; import { of } from 'rxjs'; @@ -46,7 +45,7 @@ describe('PropertiesViewerWidgetComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule, PropertiesViewerWidgetComponent], + imports: [NoopTranslateModule, NoopAuthModule, PropertiesViewerWidgetComponent], providers: [NodesApiService, { provide: BasicPropertiesService, useValue: { getProperties: () => [] } }] }); fixture = TestBed.createComponent(PropertiesViewerWidgetComponent); diff --git a/lib/process-services-cloud/src/lib/form/components/widgets/radio-buttons/radio-buttons-cloud.widget.spec.ts b/lib/process-services-cloud/src/lib/form/components/widgets/radio-buttons/radio-buttons-cloud.widget.spec.ts index df132594b8..7053d13621 100644 --- a/lib/process-services-cloud/src/lib/form/components/widgets/radio-buttons/radio-buttons-cloud.widget.spec.ts +++ b/lib/process-services-cloud/src/lib/form/components/widgets/radio-buttons/radio-buttons-cloud.widget.spec.ts @@ -19,7 +19,6 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { FormFieldModel, FormFieldOption, FormFieldTypes, FormModel } from '@alfresco/adf-core'; import { FormCloudService } from '../../../services/form-cloud.service'; import { RadioButtonsCloudWidgetComponent } from './radio-buttons-cloud.widget'; -import { ProcessServiceCloudTestingModule } from '../../../../testing/process-service-cloud.testing.module'; import { of, throwError } from 'rxjs'; import { HarnessLoader } from '@angular/cdk/testing'; import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed'; @@ -46,7 +45,7 @@ describe('RadioButtonsCloudWidgetComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule, RadioButtonsCloudWidgetComponent] + imports: [RadioButtonsCloudWidgetComponent] }); formCloudService = TestBed.inject(FormCloudService); formUtilsService = TestBed.inject(FormUtilsService); diff --git a/lib/process-services-cloud/src/lib/form/services/content-cloud-node-selector.service.spec.ts b/lib/process-services-cloud/src/lib/form/services/content-cloud-node-selector.service.spec.ts index 96eda31228..1fd738ae58 100644 --- a/lib/process-services-cloud/src/lib/form/services/content-cloud-node-selector.service.spec.ts +++ b/lib/process-services-cloud/src/lib/form/services/content-cloud-node-selector.service.spec.ts @@ -17,8 +17,7 @@ import { TestBed } from '@angular/core/testing'; import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services'; -import { NotificationService } from '@alfresco/adf-core'; -import { ProcessServiceCloudTestingModule } from '../../testing/process-service-cloud.testing.module'; +import { NotificationService, NoopTranslateModule } from '@alfresco/adf-core'; import { MatDialog, MatDialogModule } from '@angular/material/dialog'; import { of, Subject } from 'rxjs'; import { ContentCloudNodeSelectorService } from './content-cloud-node-selector.service'; @@ -51,7 +50,7 @@ describe('ContentCloudNodeSelectorService', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule, MatDialogModule], + imports: [NoopTranslateModule, MatDialogModule], providers: [{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }] }); service = TestBed.inject(ContentCloudNodeSelectorService); diff --git a/lib/process-services-cloud/src/lib/form/services/form-cloud.service.spec.ts b/lib/process-services-cloud/src/lib/form/services/form-cloud.service.spec.ts index 05934d63db..f950c6eac8 100644 --- a/lib/process-services-cloud/src/lib/form/services/form-cloud.service.spec.ts +++ b/lib/process-services-cloud/src/lib/form/services/form-cloud.service.spec.ts @@ -18,9 +18,8 @@ import { TestBed } from '@angular/core/testing'; import { FORM_CLOUD_SERVICE_FIELD_VALIDATORS_TOKEN, FormCloudService } from './form-cloud.service'; import { of } from 'rxjs'; -import { ProcessServiceCloudTestingModule } from '../../testing/process-service-cloud.testing.module'; import { AdfHttpClient } from '@alfresco/adf-core/api'; -import { FORM_FIELD_VALIDATORS, FormFieldValidator } from '@alfresco/adf-core'; +import { FORM_FIELD_VALIDATORS, FormFieldValidator, NoopAuthModule } from '@alfresco/adf-core'; const mockTaskResponseBody = { entry: { id: 'id', name: 'name', formKey: 'form-key' } @@ -44,7 +43,7 @@ describe('Form Cloud service', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule], + imports: [NoopAuthModule], providers: [{ provide: FORM_CLOUD_SERVICE_FIELD_VALIDATORS_TOKEN, useValue: [fakeValidator] }] }); service = TestBed.inject(FormCloudService); diff --git a/lib/process-services-cloud/src/lib/form/services/form-definition-selector-cloud.service.spec.ts b/lib/process-services-cloud/src/lib/form/services/form-definition-selector-cloud.service.spec.ts index 579fc4ca13..f7458429a6 100644 --- a/lib/process-services-cloud/src/lib/form/services/form-definition-selector-cloud.service.spec.ts +++ b/lib/process-services-cloud/src/lib/form/services/form-definition-selector-cloud.service.spec.ts @@ -17,9 +17,9 @@ import { TestBed } from '@angular/core/testing'; import { FormDefinitionSelectorCloudService } from './form-definition-selector-cloud.service'; -import { ProcessServiceCloudTestingModule } from '../../testing/process-service-cloud.testing.module'; import { mockFormRepresentations } from '../mocks/form-representation.mock'; import { AdfHttpClient } from '@alfresco/adf-core/api'; +import { NoopTranslateModule } from '@alfresco/adf-core'; describe('Form Definition Selector Cloud Service', () => { let service: FormDefinitionSelectorCloudService; @@ -28,7 +28,7 @@ describe('Form Definition Selector Cloud Service', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule] + imports: [NoopTranslateModule] }); service = TestBed.inject(FormDefinitionSelectorCloudService); adfHttpClient = TestBed.inject(AdfHttpClient); diff --git a/lib/process-services-cloud/src/lib/group/components/group-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/group/components/group-cloud.component.spec.ts index dbe8898b85..a1dcf6244d 100644 --- a/lib/process-services-cloud/src/lib/group/components/group-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/group/components/group-cloud.component.spec.ts @@ -19,7 +19,6 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { of } from 'rxjs'; import { GroupCloudComponent } from './group-cloud.component'; -import { CoreTestingModule } from '@alfresco/adf-core'; import { DebugElement, SimpleChange } from '@angular/core'; import { IdentityGroupService } from '../services/identity-group.service'; import { mockFoodGroups, mockMeatChicken, mockVegetableAubergine } from '../mock/group-cloud.mock'; @@ -71,7 +70,7 @@ describe('GroupCloudComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule, GroupCloudComponent] + imports: [GroupCloudComponent] }); fixture = TestBed.createComponent(GroupCloudComponent); component = fixture.componentInstance; diff --git a/lib/process-services-cloud/src/lib/people/components/people-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/people/components/people-cloud.component.spec.ts index 1e248805b3..60cef1c47f 100644 --- a/lib/process-services-cloud/src/lib/people/components/people-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/people/components/people-cloud.component.spec.ts @@ -17,8 +17,7 @@ import { PeopleCloudComponent } from './people-cloud.component'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { CoreTestingModule } from '@alfresco/adf-core'; -import { ProcessServiceCloudTestingModule } from '../../testing/process-service-cloud.testing.module'; +import { NoopAuthModule } from '@alfresco/adf-core'; import { DebugElement, SimpleChange } from '@angular/core'; import { By } from '@angular/platform-browser'; import { of } from 'rxjs'; @@ -28,7 +27,7 @@ import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed'; import { MatChipHarness } from '@angular/material/chips/testing'; import { MatInputHarness } from '@angular/material/input/testing'; import { MatFormFieldHarness } from '@angular/material/form-field/testing'; -import { IdentityUserService } from '@alfresco/adf-process-services-cloud'; +import { IdentityUserService } from '../services/identity-user.service'; describe('PeopleCloudComponent', () => { let loader: HarnessLoader; @@ -81,7 +80,7 @@ describe('PeopleCloudComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule, ProcessServiceCloudTestingModule, PeopleCloudComponent] + imports: [NoopAuthModule, PeopleCloudComponent] }); fixture = TestBed.createComponent(PeopleCloudComponent); component = fixture.componentInstance; diff --git a/lib/process-services-cloud/src/lib/people/services/identity-user.service.spec.ts b/lib/process-services-cloud/src/lib/people/services/identity-user.service.spec.ts index c3b1fb7b51..8299d1ed9a 100644 --- a/lib/process-services-cloud/src/lib/people/services/identity-user.service.spec.ts +++ b/lib/process-services-cloud/src/lib/people/services/identity-user.service.spec.ts @@ -17,10 +17,10 @@ import { TestBed } from '@angular/core/testing'; import { IdentityUserService } from './identity-user.service'; -import { ProcessServiceCloudTestingModule } from '../../testing/process-service-cloud.testing.module'; import { mockFoodUsers } from '../mock/people-cloud.mock'; import { AdfHttpClient } from '@alfresco/adf-core/api'; import { HttpErrorResponse } from '@angular/common/http'; +import { NoopTranslateModule, NoopAuthModule } from '@alfresco/adf-core'; const mockHttpErrorResponse = new HttpErrorResponse({ error: 'Mock Error', @@ -35,7 +35,7 @@ describe('IdentityUserService', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule] + imports: [NoopTranslateModule, NoopAuthModule] }); service = TestBed.inject(IdentityUserService); adfHttpClient = TestBed.inject(AdfHttpClient); diff --git a/lib/process-services-cloud/src/lib/process-services-cloud.module.ts b/lib/process-services-cloud/src/lib/process-services-cloud.module.ts index 1304179e07..c8f9214933 100644 --- a/lib/process-services-cloud/src/lib/process-services-cloud.module.ts +++ b/lib/process-services-cloud/src/lib/process-services-cloud.module.ts @@ -16,24 +16,18 @@ */ import { NgModule, ModuleWithProviders } from '@angular/core'; -import { FormRenderingService, provideTranslations } from '@alfresco/adf-core'; +import { provideTranslations } from '@alfresco/adf-core'; import { APP_LIST_CLOUD_DIRECTIVES } from './app/app-list-cloud.module'; import { TaskCloudModule } from './task/task-cloud.module'; import { ProcessCloudModule } from './process/process-cloud.module'; import { FORM_CLOUD_DIRECTIVES } from './form/form-cloud.module'; import { TASK_FORM_CLOUD_DIRECTIVES } from './task/task-form/task-form.module'; -import { - LocalPreferenceCloudService, - PreferenceCloudServiceInterface, - PROCESS_FILTERS_SERVICE_TOKEN, - TASK_FILTERS_SERVICE_TOKEN, - PROCESS_LISTS_PREFERENCES_SERVICE_TOKEN, - TASK_LIST_PREFERENCES_SERVICE_TOKEN -} from './services/public-api'; -import { CloudFormRenderingService } from './form/components/cloud-form-rendering.service'; +import { PreferenceCloudServiceInterface, TASK_LIST_CLOUD_TOKEN } from './services/public-api'; import { RichTextEditorComponent } from './rich-text-editor'; import { GroupCloudComponent } from './group/components/group-cloud.component'; import { PeopleCloudComponent } from './people/components/people-cloud.component'; +import { provideCloudFormRenderer, provideCloudPreferences } from './providers'; +import { TaskListCloudService } from './task/task-list/services/task-list-cloud.service'; export const PROCESS_SERVICES_CLOUD_DIRECTIVES = [ ...APP_LIST_CLOUD_DIRECTIVES, @@ -43,9 +37,20 @@ export const PROCESS_SERVICES_CLOUD_DIRECTIVES = [ RichTextEditorComponent ] as const; +/** + * @deprecated this module is deprecated and will be removed in the future versions + * + * Instead, import the standalone components directly, or use the following provider API to replicate the behaviour: + * + * providers: [ + * provideTranslations('adf-process-services-cloud', 'assets/adf-process-services-cloud') + * provideCloudPreferences() + * provideCloudFormRenderer(), + * { provide: TASK_LIST_CLOUD_TOKEN, useClass: TaskListCloudService } + * ] + */ @NgModule({ imports: [ProcessCloudModule, TaskCloudModule, GroupCloudComponent, ...PROCESS_SERVICES_CLOUD_DIRECTIVES], - providers: [provideTranslations('adf-process-services-cloud', 'assets/adf-process-services-cloud')], exports: [ProcessCloudModule, TaskCloudModule, GroupCloudComponent, ...PROCESS_SERVICES_CLOUD_DIRECTIVES] }) export class ProcessServicesCloudModule { @@ -57,12 +62,12 @@ export class ProcessServicesCloudModule { ngModule: ProcessServicesCloudModule, providers: [ provideTranslations('adf-process-services-cloud', 'assets/adf-process-services-cloud'), - { provide: PROCESS_FILTERS_SERVICE_TOKEN, useExisting: filterPreferenceServiceInstance ?? LocalPreferenceCloudService }, - { provide: TASK_FILTERS_SERVICE_TOKEN, useExisting: filterPreferenceServiceInstance ?? LocalPreferenceCloudService }, - { provide: PROCESS_LISTS_PREFERENCES_SERVICE_TOKEN, useExisting: listPreferenceServiceInstance ?? LocalPreferenceCloudService }, - { provide: TASK_LIST_PREFERENCES_SERVICE_TOKEN, useExisting: listPreferenceServiceInstance ?? LocalPreferenceCloudService }, - FormRenderingService, - { provide: FormRenderingService, useClass: CloudFormRenderingService } + provideCloudPreferences({ + filterPreferenceServiceInstance, + listPreferenceServiceInstance + }), + provideCloudFormRenderer(), + { provide: TASK_LIST_CLOUD_TOKEN, useClass: TaskListCloudService } ] }; } diff --git a/lib/process-services-cloud/src/lib/process/process-filters/components/edit-process-filter/edit-process-filter-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/process/process-filters/components/edit-process-filter/edit-process-filter-cloud.component.spec.ts index 3358d8c5ef..282d751b58 100644 --- a/lib/process-services-cloud/src/lib/process/process-filters/components/edit-process-filter/edit-process-filter-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/process/process-filters/components/edit-process-filter/edit-process-filter-cloud.component.spec.ts @@ -16,7 +16,7 @@ */ import { AlfrescoApiService } from '@alfresco/adf-content-services'; -import { ADF_DATE_FORMATS, NoopAuthModule, NoopTranslateModule, UserPreferencesService } from '@alfresco/adf-core'; +import { ADF_DATE_FORMATS, NoopAuthModule, UserPreferencesService } from '@alfresco/adf-core'; import { HarnessLoader } from '@angular/cdk/testing'; import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed'; import { SimpleChange } from '@angular/core'; @@ -28,7 +28,6 @@ import { MatExpansionPanelHarness } from '@angular/material/expansion/testing'; import { MatIconTestingModule } from '@angular/material/icon/testing'; import { MatProgressSpinnerHarness } from '@angular/material/progress-spinner/testing'; import { MatSelectHarness } from '@angular/material/select/testing'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { endOfDay, format, isValid, startOfDay, subYears } from 'date-fns'; import { enUS } from 'date-fns/locale'; import { of } from 'rxjs'; @@ -51,7 +50,7 @@ import { PROCESS_FILTER_ACTION_SAVE_DEFAULT } from './edit-process-filter-cloud.component'; import { ProcessFilterDialogCloudComponent } from '../process-filter-dialog/process-filter-dialog-cloud.component'; -import { IdentityUserService } from '@alfresco/adf-process-services-cloud'; +import { IdentityUserService } from '../../../../people/services/identity-user.service'; describe('EditProcessFilterCloudComponent', () => { let loader: HarnessLoader; @@ -90,14 +89,7 @@ describe('EditProcessFilterCloudComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ - NoopAuthModule, - MatIconTestingModule, - MatDialogModule, - NoopTranslateModule, - NoopAnimationsModule, - EditProcessFilterCloudComponent - ], + imports: [NoopAuthModule, MatIconTestingModule, MatDialogModule, EditProcessFilterCloudComponent], providers: [ { provide: PROCESS_FILTERS_SERVICE_TOKEN, useClass: LocalPreferenceCloudService }, { provide: MAT_DATE_LOCALE, useValue: enUS }, diff --git a/lib/process-services-cloud/src/lib/process/process-filters/components/process-filter-dialog/process-filter-dialog-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/process/process-filters/components/process-filter-dialog/process-filter-dialog-cloud.component.spec.ts index 16092e1460..f08189bd84 100644 --- a/lib/process-services-cloud/src/lib/process/process-filters/components/process-filter-dialog/process-filter-dialog-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/process/process-filters/components/process-filter-dialog/process-filter-dialog-cloud.component.spec.ts @@ -18,7 +18,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; import { ProcessFilterDialogCloudComponent } from './process-filter-dialog-cloud.component'; -import { ProcessServiceCloudTestingModule } from '../../../../testing/process-service-cloud.testing.module'; +import { NoopTranslateModule } from '@alfresco/adf-core'; describe('ProcessFilterDialogCloudComponent', () => { let component: ProcessFilterDialogCloudComponent; @@ -35,7 +35,7 @@ describe('ProcessFilterDialogCloudComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule, ProcessFilterDialogCloudComponent], + imports: [NoopTranslateModule, ProcessFilterDialogCloudComponent], providers: [ { provide: MatDialogRef, useValue: mockDialogRef }, { provide: MAT_DIALOG_DATA, useValue: mockDialogData } diff --git a/lib/process-services-cloud/src/lib/process/process-filters/components/process-filters/process-filters-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/process/process-filters/components/process-filters/process-filters-cloud.component.spec.ts index 8b35916d5e..8495132621 100644 --- a/lib/process-services-cloud/src/lib/process/process-filters/components/process-filters/process-filters-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/process/process-filters/components/process-filters/process-filters-cloud.component.spec.ts @@ -24,9 +24,8 @@ import { By } from '@angular/platform-browser'; import { PROCESS_FILTERS_SERVICE_TOKEN } from '../../../../services/cloud-token.service'; import { LocalPreferenceCloudService } from '../../../../services/local-preference-cloud.service'; import { mockProcessFilters } from '../../mock/process-filters-cloud.mock'; -import { AppConfigService, AppConfigServiceMock, NoopTranslateModule } from '@alfresco/adf-core'; +import { AppConfigService, AppConfigServiceMock } from '@alfresco/adf-core'; import { ProcessListCloudService } from '../../../process-list/services/process-list-cloud.service'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { ApolloTestingModule } from 'apollo-angular/testing'; const ProcessFilterCloudServiceMock = { @@ -44,7 +43,7 @@ describe('ProcessFiltersCloudComponent', () => { const configureTestingModule = (searchApiMethod: 'GET' | 'POST') => { TestBed.configureTestingModule({ - imports: [NoopTranslateModule, NoopAnimationsModule, ProcessFiltersCloudComponent, ApolloTestingModule], + imports: [ProcessFiltersCloudComponent, ApolloTestingModule], providers: [ { provide: PROCESS_FILTERS_SERVICE_TOKEN, useClass: LocalPreferenceCloudService }, { provide: AppConfigService, useClass: AppConfigServiceMock }, diff --git a/lib/process-services-cloud/src/lib/process/process-filters/services/process-filter-cloud.service.spec.ts b/lib/process-services-cloud/src/lib/process/process-filters/services/process-filter-cloud.service.spec.ts index 761f84a4f9..a426b4b5eb 100644 --- a/lib/process-services-cloud/src/lib/process/process-filters/services/process-filter-cloud.service.spec.ts +++ b/lib/process-services-cloud/src/lib/process/process-filters/services/process-filter-cloud.service.spec.ts @@ -20,7 +20,6 @@ import { firstValueFrom, of } from 'rxjs'; import { ProcessFilterCloudService } from './process-filter-cloud.service'; import { PROCESS_FILTERS_SERVICE_TOKEN } from '../../../services/cloud-token.service'; import { LocalPreferenceCloudService } from '../../../services/local-preference-cloud.service'; -import { ProcessServiceCloudTestingModule } from '../../../testing/process-service-cloud.testing.module'; import { fakeEmptyProcessCloudFilterEntries, fakeProcessCloudFilterEntries, @@ -33,6 +32,7 @@ import { ProcessFilterCloudModel } from '../models/process-filter-cloud.model'; import { IdentityUserService } from '../../../people/services/identity-user.service'; import { NotificationCloudService } from '../../../services/notification-cloud.service'; import { ApolloTestingModule } from 'apollo-angular/testing'; +import { NoopTranslateModule, NoopAuthModule } from '@alfresco/adf-core'; describe('ProcessFilterCloudService', () => { let service: ProcessFilterCloudService; @@ -52,7 +52,7 @@ describe('ProcessFilterCloudService', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule, ApolloTestingModule], + imports: [NoopTranslateModule, NoopAuthModule, ApolloTestingModule], providers: [{ provide: PROCESS_FILTERS_SERVICE_TOKEN, useClass: LocalPreferenceCloudService }] }); service = TestBed.inject(ProcessFilterCloudService); diff --git a/lib/process-services-cloud/src/lib/process/process-header/components/process-header-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/process/process-header/components/process-header-cloud.component.spec.ts index fb83acc960..c1e02b7b5e 100644 --- a/lib/process-services-cloud/src/lib/process/process-header/components/process-header-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/process/process-header/components/process-header-cloud.component.spec.ts @@ -16,10 +16,9 @@ */ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { AppConfigService } from '@alfresco/adf-core'; +import { AppConfigService, NoopAuthModule, NoopTranslateModule } from '@alfresco/adf-core'; import { By } from '@angular/platform-browser'; import { of } from 'rxjs'; -import { ProcessServiceCloudTestingModule } from '../../../testing/process-service-cloud.testing.module'; import { ProcessHeaderCloudComponent } from './process-header-cloud.component'; import { ProcessCloudService } from '../../services/process-cloud.service'; import { processInstanceDetailsCloudMock } from '../../mock/process-instance-details-cloud.mock'; @@ -32,7 +31,7 @@ describe('ProcessHeaderCloudComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule, ProcessHeaderCloudComponent] + imports: [NoopTranslateModule, NoopAuthModule, ProcessHeaderCloudComponent] }); fixture = TestBed.createComponent(ProcessHeaderCloudComponent); component = fixture.componentInstance; diff --git a/lib/process-services-cloud/src/lib/process/process-list/components/process-list-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/process/process-list/components/process-list-cloud.component.spec.ts index 86fbb65037..126105193b 100644 --- a/lib/process-services-cloud/src/lib/process/process-list/components/process-list-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/process/process-list/components/process-list-cloud.component.spec.ts @@ -29,22 +29,23 @@ import { getDataColumnMock, ObjectDataColumn, ObjectDataRow, - User + User, + NoopAuthModule, + NoopTranslateModule } from '@alfresco/adf-core'; import { ProcessListCloudService } from '../services/process-list-cloud.service'; import { ProcessListCloudComponent } from './process-list-cloud.component'; import { of, throwError } from 'rxjs'; import { shareReplay, skip } from 'rxjs/operators'; -import { ProcessServiceCloudTestingModule } from '../../../testing/process-service-cloud.testing.module'; import { ProcessListCloudSortingModel } from '../models/process-list-sorting.model'; import { PROCESS_LISTS_PREFERENCES_SERVICE_TOKEN } from '../../../services/cloud-token.service'; import { ProcessListCloudPreferences } from '../models/process-cloud-preferences'; import { PROCESS_LIST_CUSTOM_VARIABLE_COLUMN, ProcessListDataColumnCustomData } from '../../../models/data-column-custom-data'; -import { MatProgressSpinnerModule } from '@angular/material/progress-spinner'; import { PreferenceCloudServiceInterface } from '../../../services/preference-cloud.interface'; import { HarnessLoader } from '@angular/cdk/testing'; import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed'; import { MatProgressSpinnerHarness } from '@angular/material/progress-spinner/testing'; +import { provideCloudPreferences } from '../../../providers'; const fakeCustomSchema = [ new ObjectDataColumn({ @@ -218,7 +219,8 @@ describe('ProcessListCloudComponent', () => { const configureTestingModule = (searchApiMethod: 'GET' | 'POST') => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule, ProcessListCloudComponent] + imports: [NoopAuthModule, ProcessListCloudComponent], + providers: [provideCloudPreferences()] }); appConfig = TestBed.inject(AppConfigService); processListCloudService = TestBed.inject(ProcessListCloudService); @@ -1105,7 +1107,8 @@ describe('ProcessListCloudComponent: Injecting custom columns for task list - Cu beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule, CustomTaskListComponent] + imports: [CustomTaskListComponent], + providers: [provideCloudPreferences()] }); fixtureCustom = TestBed.createComponent(CustomTaskListComponent); fixtureCustom.detectChanges(); @@ -1150,13 +1153,7 @@ describe('ProcessListCloudComponent: Creating an empty custom template - EmptyTe beforeEach(() => { TestBed.configureTestingModule({ - imports: [ - ProcessServiceCloudTestingModule, - MatProgressSpinnerModule, - CustomEmptyContentTemplateDirective, - ProcessListCloudComponent, - EmptyTemplateComponent - ], + imports: [NoopTranslateModule, CustomEmptyContentTemplateDirective, ProcessListCloudComponent, EmptyTemplateComponent], providers: [{ provide: PROCESS_LISTS_PREFERENCES_SERVICE_TOKEN, useValue: preferencesService }] }); fixtureEmpty = TestBed.createComponent(EmptyTemplateComponent); diff --git a/lib/process-services-cloud/src/lib/process/process-list/services/process-list-cloud.service.spec.ts b/lib/process-services-cloud/src/lib/process/process-list/services/process-list-cloud.service.spec.ts index f91999fd0d..96bea5b874 100644 --- a/lib/process-services-cloud/src/lib/process/process-list/services/process-list-cloud.service.spec.ts +++ b/lib/process-services-cloud/src/lib/process/process-list/services/process-list-cloud.service.spec.ts @@ -18,9 +18,9 @@ import { fakeAsync, TestBed } from '@angular/core/testing'; import { ProcessListCloudService } from './process-list-cloud.service'; import { ProcessListRequestModel, ProcessQueryCloudRequestModel } from '../models/process-cloud-query-request.model'; -import { ProcessServiceCloudTestingModule } from '../../../testing/process-service-cloud.testing.module'; import { AdfHttpClient } from '@alfresco/adf-core/api'; import { catchError, firstValueFrom, of } from 'rxjs'; +import { NoopTranslateModule } from '@alfresco/adf-core'; describe('ProcessListCloudService', () => { let service: ProcessListCloudService; @@ -37,7 +37,7 @@ describe('ProcessListCloudService', () => { beforeEach(fakeAsync(() => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule] + imports: [NoopTranslateModule] }); adfHttpClient = TestBed.inject(AdfHttpClient); service = TestBed.inject(ProcessListCloudService); diff --git a/lib/process-services-cloud/src/lib/process/start-process/components/start-process-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/process/start-process/components/start-process-cloud.component.spec.ts index b528343c86..6d262cdcc5 100755 --- a/lib/process-services-cloud/src/lib/process/start-process/components/start-process-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/process/start-process/components/start-process-cloud.component.spec.ts @@ -37,7 +37,6 @@ import { import { By } from '@angular/platform-browser'; import { ProcessPayloadCloud } from '../models/process-payload-cloud.model'; import { ProcessWithFormPayloadCloud } from '../models/process-with-form-payload-cloud.model'; -import { ProcessServiceCloudTestingModule } from '../../../testing/process-service-cloud.testing.module'; import { ProcessInstanceCloud } from '../models/process-instance-cloud.model'; import { ESCAPE } from '@angular/cdk/keycodes'; import { ProcessDefinitionCloud } from '../../../models/process-definition-cloud.model'; @@ -85,7 +84,7 @@ describe('StartProcessCloudComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule, StartProcessCloudComponent] + imports: [StartProcessCloudComponent] }); processService = TestBed.inject(StartProcessCloudService); formCloudService = TestBed.inject(FormCloudService); diff --git a/lib/process-services-cloud/src/lib/providers.ts b/lib/process-services-cloud/src/lib/providers.ts new file mode 100644 index 0000000000..c26aac3aa7 --- /dev/null +++ b/lib/process-services-cloud/src/lib/providers.ts @@ -0,0 +1,57 @@ +/*! + * @license + * Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { PreferenceCloudServiceInterface } from './services/preference-cloud.interface'; +import { Provider } from '@angular/core'; +import { + PROCESS_FILTERS_SERVICE_TOKEN, + PROCESS_LISTS_PREFERENCES_SERVICE_TOKEN, + TASK_FILTERS_SERVICE_TOKEN, + TASK_LIST_PREFERENCES_SERVICE_TOKEN +} from './services/cloud-token.service'; +import { LocalPreferenceCloudService } from './services/local-preference-cloud.service'; +import { FormRenderingService } from '@alfresco/adf-core'; +import { CloudFormRenderingService } from './form/components/cloud-form-rendering.service'; + +/** + * Provides preferences service for the process services cloud components + * + * @param opts Optional settings + * @param opts.filterPreferenceServiceInstance Custom filter instance for `PROCESS_FILTERS_SERVICE_TOKEN` and `TASK_FILTERS_SERVICE_TOKEN` (default: LocalPreferenceCloudService) + * @param opts.listPreferenceServiceInstance Custom filter instance for `PROCESS_LISTS_PREFERENCES_SERVICE_TOKEN` and `TASK_LIST_PREFERENCES_SERVICE_TOKEN` (default: LocalPreferenceCloudService) + * @returns list of providers + */ +export function provideCloudPreferences(opts?: { + filterPreferenceServiceInstance?: PreferenceCloudServiceInterface; + listPreferenceServiceInstance?: PreferenceCloudServiceInterface; +}): Provider[] { + return [ + { provide: PROCESS_FILTERS_SERVICE_TOKEN, useExisting: opts?.filterPreferenceServiceInstance ?? LocalPreferenceCloudService }, + { provide: TASK_FILTERS_SERVICE_TOKEN, useExisting: opts?.filterPreferenceServiceInstance ?? LocalPreferenceCloudService }, + { provide: PROCESS_LISTS_PREFERENCES_SERVICE_TOKEN, useExisting: opts?.listPreferenceServiceInstance ?? LocalPreferenceCloudService }, + { provide: TASK_LIST_PREFERENCES_SERVICE_TOKEN, useExisting: opts?.listPreferenceServiceInstance ?? LocalPreferenceCloudService } + ]; +} + +/** + * Provides form rendering services for process cloud components + * + * @returns list of providers + */ +export function provideCloudFormRenderer(): Provider[] { + return [FormRenderingService, { provide: FormRenderingService, useClass: CloudFormRenderingService }]; +} diff --git a/lib/process-services-cloud/src/lib/services/user-preference-cloud.service.spec.ts b/lib/process-services-cloud/src/lib/services/user-preference-cloud.service.spec.ts index c294e01ffa..5f1059490c 100644 --- a/lib/process-services-cloud/src/lib/services/user-preference-cloud.service.spec.ts +++ b/lib/process-services-cloud/src/lib/services/user-preference-cloud.service.spec.ts @@ -18,8 +18,8 @@ import { TestBed } from '@angular/core/testing'; import { UserPreferenceCloudService } from './user-preference-cloud.service'; import { mockPreferences, getMockPreference, createMockPreference, updateMockPreference } from '../mock/user-preference.mock'; -import { ProcessServiceCloudTestingModule } from '../testing/process-service-cloud.testing.module'; import { AdfHttpClient } from '@alfresco/adf-core/api'; +import { NoopTranslateModule } from '@alfresco/adf-core'; describe('PreferenceService', () => { let service: UserPreferenceCloudService; @@ -34,7 +34,7 @@ describe('PreferenceService', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule] + imports: [NoopTranslateModule] }); service = TestBed.inject(UserPreferenceCloudService); adfHttpClient = TestBed.inject(AdfHttpClient); diff --git a/lib/process-services-cloud/src/lib/task/services/task-cloud.service.spec.ts b/lib/process-services-cloud/src/lib/task/services/task-cloud.service.spec.ts index ad36438f70..3000735a4d 100644 --- a/lib/process-services-cloud/src/lib/task/services/task-cloud.service.spec.ts +++ b/lib/process-services-cloud/src/lib/task/services/task-cloud.service.spec.ts @@ -16,7 +16,7 @@ */ import { TestBed } from '@angular/core/testing'; -import { AppConfigService, TranslationService } from '@alfresco/adf-core'; +import { AppConfigService, TranslationService, NoopTranslateModule, NoopAuthModule } from '@alfresco/adf-core'; import { TaskCloudService } from './task-cloud.service'; import { taskCompleteCloudMock } from '../task-header/mocks/fake-complete-task.mock'; import { @@ -24,7 +24,6 @@ import { createdTaskDetailsCloudMock, emptyOwnerTaskDetailsCloudMock } from '../task-header/mocks/task-details-cloud.mock'; -import { ProcessServiceCloudTestingModule } from '../../testing/process-service-cloud.testing.module'; import { IdentityUserService } from '../../people/services/identity-user.service'; import { AdfHttpClient } from '@alfresco/adf-core/api'; @@ -82,7 +81,7 @@ describe('Task Cloud Service', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule] + imports: [NoopTranslateModule, NoopAuthModule] }); adfHttpClient = TestBed.inject(AdfHttpClient); identityUserService = TestBed.inject(IdentityUserService); diff --git a/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-service-task-filter/edit-service-task-filter-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-service-task-filter/edit-service-task-filter-cloud.component.spec.ts index f0917223c7..bf72f9bbf9 100644 --- a/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-service-task-filter/edit-service-task-filter-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-service-task-filter/edit-service-task-filter-cloud.component.spec.ts @@ -37,11 +37,10 @@ import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed'; import { MatExpansionPanelHarness } from '@angular/material/expansion/testing'; import { MatSelectHarness } from '@angular/material/select/testing'; import { MatProgressSpinnerHarness } from '@angular/material/progress-spinner/testing'; -import { NoopAuthModule, NoopTranslateModule } from '@alfresco/adf-core'; +import { NoopAuthModule } from '@alfresco/adf-core'; import { ApolloTestingModule } from 'apollo-angular/testing'; import { DateAdapter, MAT_DATE_LOCALE } from '@angular/material/core'; import { DateFnsAdapter } from '@angular/material-date-fns-adapter'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; describe('EditServiceTaskFilterCloudComponent', () => { let loader: HarnessLoader; @@ -57,14 +56,7 @@ describe('EditServiceTaskFilterCloudComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ - MatIconTestingModule, - NoopAnimationsModule, - EditServiceTaskFilterCloudComponent, - NoopTranslateModule, - ApolloTestingModule, - NoopAuthModule - ], + imports: [MatIconTestingModule, EditServiceTaskFilterCloudComponent, ApolloTestingModule, NoopAuthModule], providers: [ MatDialog, { provide: TASK_FILTERS_SERVICE_TOKEN, useClass: LocalPreferenceCloudService }, diff --git a/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-task-filter/edit-task-filter-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-task-filter/edit-task-filter-cloud.component.spec.ts index 060a882b4d..4841ab58a4 100644 --- a/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-task-filter/edit-task-filter-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/task/task-filters/components/edit-task-filters/edit-task-filter/edit-task-filter-cloud.component.spec.ts @@ -54,12 +54,11 @@ import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed'; import { MatSelectHarness } from '@angular/material/select/testing'; import { MatExpansionPanelHarness } from '@angular/material/expansion/testing'; import { MatProgressSpinnerHarness } from '@angular/material/progress-spinner/testing'; -import { PeopleCloudComponent } from '@alfresco/adf-process-services-cloud'; import { ApolloTestingModule } from 'apollo-angular/testing'; -import { ADF_DATE_FORMATS, NoopAuthModule, NoopTranslateModule } from '@alfresco/adf-core'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; +import { ADF_DATE_FORMATS, NoopAuthModule } from '@alfresco/adf-core'; import { DateAdapter, MAT_DATE_FORMATS, MAT_DATE_LOCALE } from '@angular/material/core'; import { DateFnsAdapter } from '@angular/material-date-fns-adapter'; +import { PeopleCloudComponent } from '../../../../../people/components/people-cloud.component'; describe('EditTaskFilterCloudComponent', () => { let loader: HarnessLoader; @@ -77,15 +76,7 @@ describe('EditTaskFilterCloudComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ - NoopAuthModule, - NoopAnimationsModule, - NoopTranslateModule, - PeopleCloudComponent, - MatIconTestingModule, - EditTaskFilterCloudComponent, - ApolloTestingModule - ], + imports: [NoopAuthModule, PeopleCloudComponent, MatIconTestingModule, EditTaskFilterCloudComponent, ApolloTestingModule], providers: [ MatDialog, { provide: TASK_FILTERS_SERVICE_TOKEN, useClass: LocalPreferenceCloudService }, diff --git a/lib/process-services-cloud/src/lib/task/task-filters/components/service-task-filters/service-task-filters-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/task/task-filters/components/service-task-filters/service-task-filters-cloud.component.spec.ts index faddef7436..02d356b1de 100644 --- a/lib/process-services-cloud/src/lib/task/task-filters/components/service-task-filters/service-task-filters-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/task/task-filters/components/service-task-filters/service-task-filters-cloud.component.spec.ts @@ -21,10 +21,10 @@ import { of, throwError } from 'rxjs'; import { TASK_FILTERS_SERVICE_TOKEN } from '../../../../services/cloud-token.service'; import { LocalPreferenceCloudService } from '../../../../services/local-preference-cloud.service'; import { By } from '@angular/platform-browser'; -import { ProcessServiceCloudTestingModule } from '../../../../testing/process-service-cloud.testing.module'; import { fakeGlobalServiceFilters } from '../../mock/task-filters-cloud.mock'; import { ServiceTaskFilterCloudService } from '../../services/service-task-filter-cloud.service'; import { ServiceTaskFiltersCloudComponent } from './service-task-filters-cloud.component'; +import { NoopAuthModule, NoopTranslateModule } from '@alfresco/adf-core'; describe('ServiceTaskFiltersCloudComponent', () => { let serviceTaskFilterCloudService: ServiceTaskFilterCloudService; @@ -35,7 +35,7 @@ describe('ServiceTaskFiltersCloudComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule, ServiceTaskFiltersCloudComponent], + imports: [NoopTranslateModule, NoopAuthModule, ServiceTaskFiltersCloudComponent], providers: [{ provide: TASK_FILTERS_SERVICE_TOKEN, useClass: LocalPreferenceCloudService }] }); fixture = TestBed.createComponent(ServiceTaskFiltersCloudComponent); diff --git a/lib/process-services-cloud/src/lib/task/task-filters/components/task-assignment-filter/task-assignment-filter.component.spec.ts b/lib/process-services-cloud/src/lib/task/task-filters/components/task-assignment-filter/task-assignment-filter.component.spec.ts index 34f00510e6..86946b7abf 100644 --- a/lib/process-services-cloud/src/lib/task/task-filters/components/task-assignment-filter/task-assignment-filter.component.spec.ts +++ b/lib/process-services-cloud/src/lib/task/task-filters/components/task-assignment-filter/task-assignment-filter.component.spec.ts @@ -27,8 +27,8 @@ import { HarnessLoader } from '@angular/cdk/testing'; import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed'; import { MatSelectHarness } from '@angular/material/select/testing'; import { MatFormFieldHarness } from '@angular/material/form-field/testing'; -import { ProcessServiceCloudTestingModule } from '../../../../testing/process-service-cloud.testing.module'; -import { GroupCloudComponent } from '@alfresco/adf-process-services-cloud'; +import { NoopTranslateModule, NoopAuthModule } from '@alfresco/adf-core'; +import { GroupCloudComponent } from '../../../../group/components/group-cloud.component'; describe('TaskAssignmentFilterComponent', () => { let component: TaskAssignmentFilterCloudComponent; @@ -57,7 +57,7 @@ describe('TaskAssignmentFilterComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule, GroupCloudComponent, TaskAssignmentFilterCloudComponent] + imports: [NoopTranslateModule, NoopAuthModule, GroupCloudComponent, TaskAssignmentFilterCloudComponent] }); }); diff --git a/lib/process-services-cloud/src/lib/task/task-filters/components/task-filter-dialog/task-filter-dialog-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/task/task-filters/components/task-filter-dialog/task-filter-dialog-cloud.component.spec.ts index 7667547348..ff5dd22371 100644 --- a/lib/process-services-cloud/src/lib/task/task-filters/components/task-filter-dialog/task-filter-dialog-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/task/task-filters/components/task-filter-dialog/task-filter-dialog-cloud.component.spec.ts @@ -18,7 +18,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; import { TaskFilterDialogCloudComponent } from './task-filter-dialog-cloud.component'; -import { ProcessServiceCloudTestingModule } from '../../../../testing/process-service-cloud.testing.module'; +import { NoopTranslateModule } from '@alfresco/adf-core'; describe('TaskFilterDialogCloudComponent', () => { let component: TaskFilterDialogCloudComponent; @@ -35,7 +35,7 @@ describe('TaskFilterDialogCloudComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule, TaskFilterDialogCloudComponent], + imports: [NoopTranslateModule, TaskFilterDialogCloudComponent], providers: [ { provide: MatDialogRef, useValue: mockDialogRef }, { provide: MAT_DIALOG_DATA, useValue: mockDialogData } diff --git a/lib/process-services-cloud/src/lib/task/task-filters/components/task-filters/task-filters-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/task/task-filters/components/task-filters/task-filters-cloud.component.spec.ts index 0764a28861..26a1c4d6db 100644 --- a/lib/process-services-cloud/src/lib/task/task-filters/components/task-filters/task-filters-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/task/task-filters/components/task-filters/task-filters-cloud.component.spec.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { AppConfigService, NoopAuthModule, NoopTranslateModule } from '@alfresco/adf-core'; +import { AppConfigService, NoopAuthModule } from '@alfresco/adf-core'; import { SimpleChange } from '@angular/core'; import { ComponentFixture, TestBed, fakeAsync, flush } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; @@ -31,7 +31,6 @@ import { MatActionListItemHarness } from '@angular/material/list/testing'; import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed'; import { TaskFilterCloudAdapter } from '../../../../models/filter-cloud-model'; import { ApolloTestingModule } from 'apollo-angular/testing'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; import { TaskFilterCloudModel } from '../../models/filter-cloud.model'; describe('TaskFiltersCloudComponent', () => { @@ -48,7 +47,7 @@ describe('TaskFiltersCloudComponent', () => { const configureTestingModule = (searchApiMethod: 'GET' | 'POST') => { TestBed.configureTestingModule({ - imports: [NoopAuthModule, NoopAnimationsModule, NoopTranslateModule, TaskFiltersCloudComponent, ApolloTestingModule], + imports: [NoopAuthModule, TaskFiltersCloudComponent, ApolloTestingModule], providers: [{ provide: TASK_FILTERS_SERVICE_TOKEN, useClass: LocalPreferenceCloudService }] }); taskFilterService = TestBed.inject(TaskFilterCloudService); diff --git a/lib/process-services-cloud/src/lib/task/task-filters/services/task-filter-cloud.service.spec.ts b/lib/process-services-cloud/src/lib/task/task-filters/services/task-filter-cloud.service.spec.ts index 58c195cb61..73d0138af9 100644 --- a/lib/process-services-cloud/src/lib/task/task-filters/services/task-filter-cloud.service.spec.ts +++ b/lib/process-services-cloud/src/lib/task/task-filters/services/task-filter-cloud.service.spec.ts @@ -30,13 +30,11 @@ import { } from '../mock/task-filters-cloud.mock'; import { UserPreferenceCloudService } from '../../../services/user-preference-cloud.service'; import { PreferenceCloudServiceInterface } from '../../../services/preference-cloud.interface'; -import { HttpClientTestingModule } from '@angular/common/http/testing'; import { NotificationCloudService } from '../../../services/notification-cloud.service'; -import { ProcessServiceCloudTestingModule } from '../../../testing/process-service-cloud.testing.module'; import { IdentityUserService } from '../../../people/services/identity-user.service'; -import { StorageService } from '@alfresco/adf-core'; -import { TaskStatusFilter } from '../public-api'; import { ApolloTestingModule } from 'apollo-angular/testing'; +import { StorageService, NoopAuthModule, NoopTranslateModule } from '@alfresco/adf-core'; +import { TaskStatusFilter } from '../models/filter-cloud.model'; describe('TaskFilterCloudService', () => { let service: TaskFilterCloudService; @@ -56,7 +54,7 @@ describe('TaskFilterCloudService', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [HttpClientTestingModule, ProcessServiceCloudTestingModule, ApolloTestingModule], + imports: [NoopTranslateModule, NoopAuthModule, ApolloTestingModule], providers: [{ provide: TASK_FILTERS_SERVICE_TOKEN, useClass: UserPreferenceCloudService }] }); service = TestBed.inject(TaskFilterCloudService); @@ -265,7 +263,7 @@ describe('Inject [LocalPreferenceCloudService] into the TaskFilterCloudService', beforeEach(() => { TestBed.configureTestingModule({ - imports: [HttpClientTestingModule, ProcessServiceCloudTestingModule, ApolloTestingModule], + imports: [NoopTranslateModule, NoopAuthModule, ApolloTestingModule], providers: [{ provide: TASK_FILTERS_SERVICE_TOKEN, useClass: LocalPreferenceCloudService }] }); service = TestBed.inject(TaskFilterCloudService); diff --git a/lib/process-services-cloud/src/lib/task/task-form/components/task-form-cloud/task-form-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/task/task-form/components/task-form-cloud/task-form-cloud.component.spec.ts index 02bc2e78d2..0dc98fc6d9 100644 --- a/lib/process-services-cloud/src/lib/task/task-form/components/task-form-cloud/task-form-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/task/task-form/components/task-form-cloud/task-form-cloud.component.spec.ts @@ -15,14 +15,12 @@ * limitations under the License. */ -import { FormModel, FormOutcomeEvent, FormOutcomeModel } from '@alfresco/adf-core'; -import { FormCustomOutcomesComponent } from '@alfresco/adf-process-services-cloud'; +import { FormModel, FormOutcomeEvent, FormOutcomeModel, NoopAuthModule, NoopTranslateModule } from '@alfresco/adf-core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { of } from 'rxjs'; import { FormCloudComponent } from '../../../../form/components/form-cloud.component'; import { DisplayModeService } from '../../../../form/services/display-mode.service'; import { IdentityUserService } from '../../../../people/services/identity-user.service'; -import { ProcessServiceCloudTestingModule } from '../../../../testing/process-service-cloud.testing.module'; import { TaskCloudService } from '../../../services/task-cloud.service'; import { TASK_ASSIGNED_STATE, @@ -34,6 +32,7 @@ import { } from '../../../models/task-details-cloud.model'; import { UserTaskCloudButtonsComponent } from '../user-task-cloud-buttons/user-task-cloud-buttons.component'; import { TaskFormCloudComponent } from './task-form-cloud.component'; +import { FormCustomOutcomesComponent } from '../../../../form/components/form-cloud-custom-outcomes.component'; const taskDetails: TaskDetailsCloudModel = { appName: 'simple-app', @@ -61,7 +60,8 @@ describe('TaskFormCloudComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ imports: [ - ProcessServiceCloudTestingModule, + NoopTranslateModule, + NoopAuthModule, FormCloudComponent, FormCustomOutcomesComponent, UserTaskCloudButtonsComponent, diff --git a/lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud-buttons/claim-task/claim-task-cloud.directive.spec.ts b/lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud-buttons/claim-task/claim-task-cloud.directive.spec.ts index 450e42514e..25b8413ddc 100644 --- a/lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud-buttons/claim-task/claim-task-cloud.directive.spec.ts +++ b/lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud-buttons/claim-task/claim-task-cloud.directive.spec.ts @@ -21,8 +21,8 @@ import { TaskCloudService } from '../../../../services/task-cloud.service'; import { of, throwError } from 'rxjs'; import { ClaimTaskCloudDirective } from './claim-task-cloud.directive'; import { taskClaimCloudMock } from '../../../../task-header/mocks/fake-claim-task.mock'; -import { ProcessServiceCloudTestingModule } from '../../../../../testing/process-service-cloud.testing.module'; import { By } from '@angular/platform-browser'; +import { NoopTranslateModule, NoopAuthModule } from '@alfresco/adf-core'; describe('ClaimTaskCloudDirective', () => { @Component({ @@ -47,8 +47,7 @@ describe('ClaimTaskCloudDirective', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule, TestComponent], - declarations: [] + imports: [NoopTranslateModule, NoopAuthModule, TestComponent] }); taskCloudService = TestBed.inject(TaskCloudService); fixture = TestBed.createComponent(TestComponent); @@ -146,38 +145,36 @@ describe('Claim Task Directive validation errors', () => { claimTaskValidationDirective: ClaimTaskCloudDirective; } - let fixture: ComponentFixture; - beforeEach(() => { TestBed.configureTestingModule({ imports: [ - ProcessServiceCloudTestingModule, + NoopTranslateModule, + NoopAuthModule, ClaimTestMissingTaskIdDirectiveComponent, ClaimTestInvalidAppNameUndefinedDirectiveComponent, ClaimTestInvalidAppNameNullDirectiveComponent, ClaimTestMissingInputDirectiveComponent ] }); - fixture = TestBed.createComponent(ClaimTestMissingInputDirectiveComponent); }); it('should throw error when missing input', () => { - fixture = TestBed.createComponent(ClaimTestMissingInputDirectiveComponent); + const fixture = TestBed.createComponent(ClaimTestMissingInputDirectiveComponent); expect(() => fixture.detectChanges()).toThrowError(); }); it('should throw error when taskId is not set', () => { - fixture = TestBed.createComponent(ClaimTestMissingTaskIdDirectiveComponent); + const fixture = TestBed.createComponent(ClaimTestMissingTaskIdDirectiveComponent); expect(() => fixture.detectChanges()).toThrowError('Attribute taskId is required'); }); it('should throw error when appName is undefined', () => { - fixture = TestBed.createComponent(ClaimTestInvalidAppNameUndefinedDirectiveComponent); + const fixture = TestBed.createComponent(ClaimTestInvalidAppNameUndefinedDirectiveComponent); expect(() => fixture.detectChanges()).toThrowError('Attribute appName is required'); }); it('should throw error when appName is null', () => { - fixture = TestBed.createComponent(ClaimTestInvalidAppNameUndefinedDirectiveComponent); + const fixture = TestBed.createComponent(ClaimTestInvalidAppNameUndefinedDirectiveComponent); expect(() => fixture.detectChanges()).toThrowError('Attribute appName is required'); }); }); diff --git a/lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud-buttons/unclaim-task/unclaim-task-cloud.directive.spec.ts b/lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud-buttons/unclaim-task/unclaim-task-cloud.directive.spec.ts index b15d0f0770..c6b6f2aa76 100644 --- a/lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud-buttons/unclaim-task/unclaim-task-cloud.directive.spec.ts +++ b/lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud-buttons/unclaim-task/unclaim-task-cloud.directive.spec.ts @@ -21,8 +21,8 @@ import { TaskCloudService } from '../../../../services/task-cloud.service'; import { of, throwError } from 'rxjs'; import { UnClaimTaskCloudDirective } from './unclaim-task-cloud.directive'; import { taskClaimCloudMock } from '../../../../task-header/mocks/fake-claim-task.mock'; -import { ProcessServiceCloudTestingModule } from '../../../../../testing/process-service-cloud.testing.module'; import { By } from '@angular/platform-browser'; +import { NoopAuthModule, NoopTranslateModule } from '@alfresco/adf-core'; describe('UnClaimTaskCloudDirective', () => { @Component({ @@ -47,7 +47,7 @@ describe('UnClaimTaskCloudDirective', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule, TestComponent] + imports: [NoopTranslateModule, NoopAuthModule, TestComponent] }); taskCloudService = TestBed.inject(TaskCloudService); fixture = TestBed.createComponent(TestComponent); @@ -145,38 +145,36 @@ describe('UnClaim Task Directive validation errors', () => { claimTaskValidationDirective: UnClaimTaskCloudDirective; } - let fixture: ComponentFixture; - beforeEach(() => { TestBed.configureTestingModule({ imports: [ - ProcessServiceCloudTestingModule, + NoopTranslateModule, + NoopAuthModule, ClaimTestMissingTaskIdDirectiveComponent, ClaimTestInvalidAppNameUndefinedDirectiveComponent, ClaimTestInvalidAppNameNullDirectiveComponent, ClaimTestMissingInputDirectiveComponent ] }); - fixture = TestBed.createComponent(ClaimTestMissingInputDirectiveComponent); }); it('should throw error when missing input', () => { - fixture = TestBed.createComponent(ClaimTestMissingInputDirectiveComponent); + const fixture = TestBed.createComponent(ClaimTestMissingInputDirectiveComponent); expect(() => fixture.detectChanges()).toThrowError(); }); it('should throw error when taskId is not set', () => { - fixture = TestBed.createComponent(ClaimTestMissingTaskIdDirectiveComponent); + const fixture = TestBed.createComponent(ClaimTestMissingTaskIdDirectiveComponent); expect(() => fixture.detectChanges()).toThrowError('Attribute taskId is required'); }); it('should throw error when appName is undefined', () => { - fixture = TestBed.createComponent(ClaimTestInvalidAppNameUndefinedDirectiveComponent); + const fixture = TestBed.createComponent(ClaimTestInvalidAppNameUndefinedDirectiveComponent); expect(() => fixture.detectChanges()).toThrowError('Attribute appName is required'); }); it('should throw error when appName is null', () => { - fixture = TestBed.createComponent(ClaimTestInvalidAppNameUndefinedDirectiveComponent); + const fixture = TestBed.createComponent(ClaimTestInvalidAppNameUndefinedDirectiveComponent); expect(() => fixture.detectChanges()).toThrowError('Attribute appName is required'); }); }); diff --git a/lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud-buttons/user-task-cloud-buttons.component.spec.ts b/lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud-buttons/user-task-cloud-buttons.component.spec.ts index 5f0d5d638c..caf5a40846 100644 --- a/lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud-buttons/user-task-cloud-buttons.component.spec.ts +++ b/lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud-buttons/user-task-cloud-buttons.component.spec.ts @@ -22,9 +22,9 @@ import { HarnessLoader } from '@angular/cdk/testing'; import { MatButtonHarness } from '@angular/material/button/testing'; import { By } from '@angular/platform-browser'; import { DebugElement } from '@angular/core'; -import { ProcessServiceCloudTestingModule } from 'lib/process-services-cloud/src/lib/testing/process-service-cloud.testing.module'; -import { TaskCloudService } from '@alfresco/adf-process-services-cloud'; import { of } from 'rxjs'; +import { NoopAuthModule } from '@alfresco/adf-core'; +import { TaskCloudService } from '../../../services/task-cloud.service'; describe('UserTaskCloudButtonsComponent', () => { let component: UserTaskCloudButtonsComponent; @@ -35,7 +35,7 @@ describe('UserTaskCloudButtonsComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule, UserTaskCloudButtonsComponent] + imports: [NoopAuthModule, UserTaskCloudButtonsComponent] }); fixture = TestBed.createComponent(UserTaskCloudButtonsComponent); debugElement = fixture.debugElement; diff --git a/lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud/complete-task/complete-task.directive.spec.ts b/lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud/complete-task/complete-task.directive.spec.ts index ab567e96f9..544d096814 100644 --- a/lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud/complete-task/complete-task.directive.spec.ts +++ b/lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud/complete-task/complete-task.directive.spec.ts @@ -21,8 +21,8 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { of, throwError } from 'rxjs'; import { taskCompleteCloudMock } from '../../../../task-header/mocks/fake-complete-task.mock'; import { TaskCloudService } from '../../../../services/task-cloud.service'; -import { ProcessServiceCloudTestingModule } from '../../../../../testing/process-service-cloud.testing.module'; import { By } from '@angular/platform-browser'; +import { NoopTranslateModule, NoopAuthModule } from '@alfresco/adf-core'; describe('CompleteTaskDirective', () => { @Component({ @@ -59,7 +59,7 @@ describe('CompleteTaskDirective', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule, TestComponent] + imports: [NoopTranslateModule, NoopAuthModule, TestComponent] }); taskCloudService = TestBed.inject(TaskCloudService); fixture = TestBed.createComponent(TestComponent); @@ -173,37 +173,36 @@ describe('Complete Task Directive validation errors', () => { } } - let fixture: ComponentFixture; - beforeEach(() => { TestBed.configureTestingModule({ imports: [ - ProcessServiceCloudTestingModule, + NoopTranslateModule, + NoopAuthModule, TestMissingTaskIdDirectiveComponent, TestInvalidAppNameUndefinedDirectiveComponent, TestInvalidAppNameNullDirectiveComponent, TestMissingInputDirectiveComponent ] }); - fixture = TestBed.createComponent(TestMissingInputDirectiveComponent); }); it('should throw error when missing input', () => { + const fixture = TestBed.createComponent(TestMissingInputDirectiveComponent); expect(() => fixture.detectChanges()).toThrowError(); }); it('should throw error when taskId is not set', () => { - fixture = TestBed.createComponent(TestMissingTaskIdDirectiveComponent); + const fixture = TestBed.createComponent(TestMissingTaskIdDirectiveComponent); expect(() => fixture.detectChanges()).toThrowError('Attribute taskId is required'); }); it('should throw error when appName is undefined', () => { - fixture = TestBed.createComponent(TestInvalidAppNameUndefinedDirectiveComponent); + const fixture = TestBed.createComponent(TestInvalidAppNameUndefinedDirectiveComponent); expect(() => fixture.detectChanges()).toThrowError('Attribute appName is required'); }); it('should throw error when appName is null', () => { - fixture = TestBed.createComponent(TestInvalidAppNameUndefinedDirectiveComponent); + const fixture = TestBed.createComponent(TestInvalidAppNameUndefinedDirectiveComponent); expect(() => fixture.detectChanges()).toThrowError('Attribute appName is required'); }); }); diff --git a/lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud/user-task-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud/user-task-cloud.component.spec.ts index 62050fa1dc..60a2e0e5ff 100644 --- a/lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud/user-task-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/task/task-form/components/user-task-cloud/user-task-cloud.component.spec.ts @@ -15,16 +15,6 @@ * limitations under the License. */ -import { - TASK_ASSIGNED_STATE, - TASK_CLAIM_PERMISSION, - TASK_CREATED_STATE, - TASK_RELEASE_PERMISSION, - TASK_VIEW_PERMISSION, - TaskCloudService, - TaskDetailsCloudModel, - TaskFormCloudComponent -} from '@alfresco/adf-process-services-cloud'; import { HarnessLoader } from '@angular/cdk/testing'; import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed'; import { Component, EventEmitter, Input, Output, SimpleChange } from '@angular/core'; @@ -32,13 +22,23 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { MatButtonHarness } from '@angular/material/button/testing'; import { MatCardHarness } from '@angular/material/card/testing'; import { MatProgressSpinnerHarness } from '@angular/material/progress-spinner/testing'; -import { ProcessServiceCloudTestingModule } from 'lib/process-services-cloud/src/lib/testing/process-service-cloud.testing.module'; import { of, throwError } from 'rxjs'; import { IdentityUserService } from '../../../../people/services/identity-user.service'; import { UserTaskCloudComponent } from './user-task-cloud.component'; import { By } from '@angular/platform-browser'; import { TaskScreenCloudComponent } from '../../../../screen/components/screen-cloud/screen-cloud.component'; import { MatCheckboxChange } from '@angular/material/checkbox'; +import { NoopAuthModule, NoopTranslateModule } from '@alfresco/adf-core'; +import { + TASK_ASSIGNED_STATE, + TASK_CLAIM_PERMISSION, + TASK_CREATED_STATE, + TASK_RELEASE_PERMISSION, + TASK_VIEW_PERMISSION, + TaskDetailsCloudModel +} from '../../../models/task-details-cloud.model'; +import { TaskFormCloudComponent } from '../task-form-cloud/task-form-cloud.component'; +import { TaskCloudService } from '../../../services/task-cloud.service'; const taskDetails: TaskDetailsCloudModel = { appName: 'simple-app', @@ -95,7 +95,7 @@ describe('UserTaskCloudComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule, UserTaskCloudComponent, TaskFormCloudComponent] + imports: [NoopTranslateModule, NoopAuthModule, UserTaskCloudComponent, TaskFormCloudComponent] }).overrideComponent(UserTaskCloudComponent, { remove: { imports: [TaskScreenCloudComponent] }, add: { imports: [TaskScreenCloudMockComponent] } diff --git a/lib/process-services-cloud/src/lib/task/task-header/components/task-header-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/task/task-header/components/task-header-cloud.component.spec.ts index 9f536731ab..e44a64fb68 100644 --- a/lib/process-services-cloud/src/lib/task/task-header/components/task-header-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/task/task-header/components/task-header-cloud.component.spec.ts @@ -20,7 +20,7 @@ import { of, throwError } from 'rxjs'; import { By } from '@angular/platform-browser'; import { ComponentFixture, TestBed, fakeAsync, flush, discardPeriodicTasks } from '@angular/core/testing'; import { AlfrescoApiService } from '@alfresco/adf-content-services'; -import { AppConfigService, NoopAuthModule, NoopTranslateModule } from '@alfresco/adf-core'; +import { AppConfigService, NoopAuthModule } from '@alfresco/adf-core'; import { TaskCloudService } from '../../services/task-cloud.service'; import { assignedTaskDetailsCloudMock, @@ -33,8 +33,6 @@ import { import { HarnessLoader } from '@angular/cdk/testing'; import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed'; import { MatSelectHarness } from '@angular/material/select/testing'; -import { HttpClientTestingModule } from '@angular/common/http/testing'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; describe('TaskHeaderCloudComponent', () => { let component: TaskHeaderCloudComponent; @@ -61,7 +59,7 @@ describe('TaskHeaderCloudComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [TaskHeaderCloudComponent, HttpClientTestingModule, NoopTranslateModule, NoopAuthModule, NoopAnimationsModule] + imports: [TaskHeaderCloudComponent, NoopAuthModule] }); appConfigService = TestBed.inject(AppConfigService); appConfigService.config = { diff --git a/lib/process-services-cloud/src/lib/task/task-list/components/service-task-list/service-task-list-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/task/task-list/components/service-task-list/service-task-list-cloud.component.spec.ts index a728189898..b8d510d89c 100644 --- a/lib/process-services-cloud/src/lib/task/task-list/components/service-task-list/service-task-list-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/task/task-list/components/service-task-list/service-task-list-cloud.component.spec.ts @@ -18,17 +18,25 @@ import { Component, SimpleChange, ViewChild } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; -import { AppConfigService, DataRowEvent, ObjectDataRow } from '@alfresco/adf-core'; +import { + AppConfigService, + DataRowEvent, + ObjectDataRow, + NoopAuthModule, + DataColumnComponent, + DataColumnListComponent, + CustomEmptyContentTemplateDirective +} from '@alfresco/adf-core'; import { ServiceTaskListCloudComponent } from './service-task-list-cloud.component'; import { fakeServiceTask, fakeCustomSchema } from '../../mock/fake-task-response.mock'; import { of } from 'rxjs'; -import { ProcessServiceCloudTestingModule } from '../../../../testing/process-service-cloud.testing.module'; import { TaskListCloudSortingModel } from '../../../../models/task-list-sorting.model'; import { shareReplay, skip } from 'rxjs/operators'; import { ServiceTaskListCloudService } from '../../services/service-task-list-cloud.service'; import { HarnessLoader } from '@angular/cdk/testing'; import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed'; import { MatProgressSpinnerHarness } from '@angular/material/progress-spinner/testing'; +import { provideCloudPreferences } from '../../../../providers'; @Component({ template: ` @@ -37,12 +45,14 @@ import { MatProgressSpinnerHarness } from '@angular/material/progress-spinner/te `, - standalone: false + standalone: true, + imports: [ServiceTaskListCloudComponent, DataColumnComponent, DataColumnListComponent] }) class CustomTaskListComponent { @ViewChild(ServiceTaskListCloudComponent) taskList: ServiceTaskListCloudComponent; } + @Component({ template: ` @@ -51,9 +61,11 @@ class CustomTaskListComponent { `, - standalone: false + standalone: true, + imports: [CustomEmptyContentTemplateDirective, ServiceTaskListCloudComponent] }) class EmptyTemplateComponent {} + @Component({ template: ` @@ -61,7 +73,8 @@ class EmptyTemplateComponent {} `, - standalone: false + standalone: true, + imports: [ServiceTaskListCloudComponent, DataColumnComponent, DataColumnListComponent] }) class CustomCopyContentTaskListComponent { @ViewChild(ServiceTaskListCloudComponent, { static: true }) @@ -72,18 +85,18 @@ describe('ServiceTaskListCloudComponent', () => { let loader: HarnessLoader; let component: ServiceTaskListCloudComponent; let fixture: ComponentFixture; - let appConfig: AppConfigService; - let serviceTaskListCloudService: ServiceTaskListCloudService; + let getServiceTaskByRequestSpy: jasmine.Spy; beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule], - declarations: [EmptyTemplateComponent] + imports: [NoopAuthModule, ServiceTaskListCloudComponent, EmptyTemplateComponent], + providers: [provideCloudPreferences()] }); - appConfig = TestBed.inject(AppConfigService); - serviceTaskListCloudService = TestBed.inject(ServiceTaskListCloudService); - fixture = TestBed.createComponent(ServiceTaskListCloudComponent); - component = fixture.componentInstance; + + const serviceTaskListCloudService = TestBed.inject(ServiceTaskListCloudService); + getServiceTaskByRequestSpy = spyOn(serviceTaskListCloudService, 'getServiceTaskByRequest'); + + const appConfig = TestBed.inject(AppConfigService); appConfig.config = Object.assign(appConfig.config, { 'adf-cloud-service-task-list': { presets: { @@ -105,6 +118,9 @@ describe('ServiceTaskListCloudComponent', () => { } }); + fixture = TestBed.createComponent(ServiceTaskListCloudComponent); + component = fixture.componentInstance; + component.isColumnSchemaCreated$ = of(true).pipe(shareReplay(1)); loader = TestbedHarnessEnvironment.loader(fixture); }); @@ -121,7 +137,7 @@ describe('ServiceTaskListCloudComponent', () => { it('should display empty content when process list is empty', async () => { const emptyList = { list: { entries: [] } }; - spyOn(serviceTaskListCloudService, 'getServiceTaskByRequest').and.returnValue(of(emptyList)); + getServiceTaskByRequestSpy.and.returnValue(of(emptyList)); fixture.detectChanges(); expect(await loader.hasHarness(MatProgressSpinnerHarness)).toBe(false); @@ -131,7 +147,7 @@ describe('ServiceTaskListCloudComponent', () => { }); it('should load spinner and show the content', async () => { - spyOn(serviceTaskListCloudService, 'getServiceTaskByRequest').and.returnValue(of(fakeServiceTask)); + getServiceTaskByRequestSpy.and.returnValue(of(fakeServiceTask)); const appName = new SimpleChange(null, 'FAKE-APP-NAME', true); fixture.detectChanges(); @@ -167,7 +183,7 @@ describe('ServiceTaskListCloudComponent', () => { }); it('should reload tasks when reload() is called', (done) => { - spyOn(serviceTaskListCloudService, 'getServiceTaskByRequest').and.returnValue(of(fakeServiceTask)); + getServiceTaskByRequestSpy.and.returnValue(of(fakeServiceTask)); component.success.subscribe((res) => { expect(res).toBeDefined(); expect(component.rows).toBeDefined(); @@ -217,7 +233,7 @@ describe('ServiceTaskListCloudComponent', () => { it('should call endpoint when a column visibility gets changed', () => { const emptyList = { list: { entries: [] } }; - spyOn(serviceTaskListCloudService, 'getServiceTaskByRequest').and.returnValue(of(emptyList)); + getServiceTaskByRequestSpy.and.returnValue(of(emptyList)); component.ngAfterContentInit(); spyOn(component, 'createDatatableSchema'); component.appName = 'fake-app-name'; @@ -228,7 +244,7 @@ describe('ServiceTaskListCloudComponent', () => { fixture.detectChanges(); - expect(serviceTaskListCloudService.getServiceTaskByRequest).toHaveBeenCalledTimes(1); + expect(getServiceTaskByRequestSpy).toHaveBeenCalledTimes(1); }); describe('component changes', () => { @@ -238,14 +254,13 @@ describe('ServiceTaskListCloudComponent', () => { }); it('should NOT reload the task list when no parameters changed', () => { - spyOn(serviceTaskListCloudService, 'getServiceTaskByRequest'); component.rows = null; fixture.detectChanges(); expect(component.isListEmpty()).toBeTruthy(); }); it('should reload the task list when input parameters changed', () => { - const getServiceTaskByRequestSpy = spyOn(serviceTaskListCloudService, 'getServiceTaskByRequest').and.returnValue(of(fakeServiceTask)); + getServiceTaskByRequestSpy.and.returnValue(of(fakeServiceTask)); component.appName = 'mock-app-name'; component.queryParams.status = 'mock-status'; const queryParams = new SimpleChange(undefined, { status: 'mock-status' }, true); @@ -258,7 +273,7 @@ describe('ServiceTaskListCloudComponent', () => { }); it('should set formattedSorting if sorting input changes', () => { - spyOn(serviceTaskListCloudService, 'getServiceTaskByRequest').and.returnValue(of(fakeServiceTask)); + getServiceTaskByRequestSpy.and.returnValue(of(fakeServiceTask)); spyOn(component, 'formatSorting').and.callThrough(); component.appName = 'mock-app-name'; @@ -278,7 +293,7 @@ describe('ServiceTaskListCloudComponent', () => { }); it('should reload task list when sorting on a column changes', () => { - const getServiceTaskByRequestSpy = spyOn(serviceTaskListCloudService, 'getServiceTaskByRequest').and.returnValue(of(fakeServiceTask)); + getServiceTaskByRequestSpy.and.returnValue(of(fakeServiceTask)); component.onSortingChanged( new CustomEvent('sorting-changed', { detail: { @@ -301,7 +316,7 @@ describe('ServiceTaskListCloudComponent', () => { }); it('should reset pagination when resetPaginationValues is called', (done) => { - spyOn(serviceTaskListCloudService, 'getServiceTaskByRequest').and.returnValue(of(fakeServiceTask)); + getServiceTaskByRequestSpy.and.returnValue(of(fakeServiceTask)); const size = component.size; const skipCount = component.skipCount; @@ -324,7 +339,7 @@ describe('ServiceTaskListCloudComponent', () => { }); it('should set pagination and reload when updatePagination is called', (done) => { - spyOn(serviceTaskListCloudService, 'getServiceTaskByRequest').and.returnValue(of(fakeServiceTask)); + getServiceTaskByRequestSpy.and.returnValue(of(fakeServiceTask)); spyOn(component, 'reload').and.stub(); const pagination = { @@ -350,15 +365,14 @@ describe('ServiceTaskListCloudComponent: Injecting custom columns for task list let componentCustom: CustomTaskListComponent; let customCopyComponent: CustomCopyContentTaskListComponent; let copyFixture: ComponentFixture; - let serviceTaskListCloudService: ServiceTaskListCloudService; beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule], - declarations: [CustomTaskListComponent, CustomCopyContentTaskListComponent] + imports: [NoopAuthModule, CustomTaskListComponent, CustomCopyContentTaskListComponent], + providers: [provideCloudPreferences()] }); - serviceTaskListCloudService = TestBed.inject(ServiceTaskListCloudService); + const serviceTaskListCloudService = TestBed.inject(ServiceTaskListCloudService); spyOn(serviceTaskListCloudService, 'getServiceTaskByRequest').and.returnValue(of(fakeServiceTask)); fixtureCustom = TestBed.createComponent(CustomTaskListComponent); @@ -406,16 +420,19 @@ describe('ServiceTaskListCloudComponent: Injecting custom columns for task list describe('ServiceTaskListCloudComponent: Copy cell content directive from app.config specifications', () => { let taskSpy: jasmine.Spy; let appConfig: AppConfigService; - let serviceTaskListCloudService: ServiceTaskListCloudService; let fixture: ComponentFixture; let component: ServiceTaskListCloudComponent; beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule] + imports: [NoopAuthModule, ServiceTaskListCloudComponent], + providers: [provideCloudPreferences()] }); + + const serviceTaskListCloudService = TestBed.inject(ServiceTaskListCloudService); + taskSpy = spyOn(serviceTaskListCloudService, 'getServiceTaskByRequest').and.returnValue(of(fakeServiceTask)); + appConfig = TestBed.inject(AppConfigService); - serviceTaskListCloudService = TestBed.inject(ServiceTaskListCloudService); appConfig.config = Object.assign(appConfig.config, { 'adf-cloud-service-task-list': { presets: { @@ -439,7 +456,6 @@ describe('ServiceTaskListCloudComponent: Copy cell content directive from app.co }); fixture = TestBed.createComponent(ServiceTaskListCloudComponent); component = fixture.componentInstance; - taskSpy = spyOn(serviceTaskListCloudService, 'getServiceTaskByRequest').and.returnValue(of(fakeServiceTask)); }); afterEach(() => { fixture.destroy(); diff --git a/lib/process-services-cloud/src/lib/task/task-list/components/task-list/task-list-cloud.component.spec.ts b/lib/process-services-cloud/src/lib/task/task-list/components/task-list/task-list-cloud.component.spec.ts index eafecf9708..949ed5b1dd 100644 --- a/lib/process-services-cloud/src/lib/task/task-list/components/task-list/task-list-cloud.component.spec.ts +++ b/lib/process-services-cloud/src/lib/task/task-list/components/task-list/task-list-cloud.component.spec.ts @@ -27,22 +27,20 @@ import { ColumnsSelectorComponent, DataColumnListComponent, DataColumnComponent, - CustomEmptyContentTemplateDirective + CustomEmptyContentTemplateDirective, + NoopAuthModule } from '@alfresco/adf-core'; import { TaskListCloudService } from '../../services/task-list-cloud.service'; import { TaskListCloudComponent } from './task-list-cloud.component'; import { fakeGlobalTasks, fakeCustomSchema, fakeGlobalTask } from '../../mock/fake-task-response.mock'; import { of } from 'rxjs'; -import { ProcessServiceCloudTestingModule } from '../../../../testing/process-service-cloud.testing.module'; import { TaskListCloudSortingModel } from '../../../../models/task-list-sorting.model'; import { shareReplay, skip } from 'rxjs/operators'; -import { TaskListCloudServiceInterface } from '../../../../services/task-list-cloud.service.interface'; import { TASK_LIST_CLOUD_TOKEN, TASK_LIST_PREFERENCES_SERVICE_TOKEN } from '../../../../services/cloud-token.service'; -import { TaskListCloudModule } from '../../task-list-cloud.module'; -import { PreferenceCloudServiceInterface } from '../../../../services/preference-cloud.interface'; import { HarnessLoader } from '@angular/cdk/testing'; import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed'; import { MatProgressSpinnerHarness } from '@angular/material/progress-spinner/testing'; +import { provideCloudPreferences } from '../../../../providers'; @Component({ imports: [TaskListCloudComponent, DataColumnListComponent, DataColumnComponent], @@ -103,15 +101,17 @@ describe('TaskListCloudComponent', () => { let component: TaskListCloudComponent; let fixture: ComponentFixture; let appConfig: AppConfigService; - let taskListCloudService: TaskListCloudServiceInterface; - const preferencesService: PreferenceCloudServiceInterface = jasmine.createSpyObj('preferencesService', { + let getTaskByRequestSpy: jasmine.Spy; + let fetchTaskListSpy: jasmine.Spy; + + const preferencesService = jasmine.createSpyObj('preferencesService', { getPreferences: of({}), updatePreference: of({}) }); const configureTestingModule = (searchApiMethod: 'GET' | 'POST') => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule, TaskListCloudComponent], + imports: [NoopAuthModule, TaskListCloudComponent], providers: [ { provide: TASK_LIST_CLOUD_TOKEN, @@ -126,7 +126,11 @@ describe('TaskListCloudComponent', () => { appConfig = TestBed.inject(AppConfigService); fixture = TestBed.createComponent(TaskListCloudComponent); component = fixture.componentInstance; - taskListCloudService = TestBed.inject(TASK_LIST_CLOUD_TOKEN); + + const taskListCloudService = TestBed.inject(TASK_LIST_CLOUD_TOKEN); + getTaskByRequestSpy = spyOn(taskListCloudService, 'getTaskByRequest'); + fetchTaskListSpy = spyOn(taskListCloudService, 'fetchTaskList').and.returnValue(of(fakeGlobalTasks)); + appConfig.config = Object.assign(appConfig.config, { 'adf-cloud-task-list': { presets: { @@ -163,7 +167,7 @@ describe('TaskListCloudComponent', () => { }); it('should load spinner and show the content', async () => { - spyOn(taskListCloudService, 'getTaskByRequest').and.returnValue(of(fakeGlobalTasks)); + getTaskByRequestSpy.and.returnValue(of(fakeGlobalTasks)); const appName = new SimpleChange(null, 'FAKE-APP-NAME', true); component.ngOnChanges({ appName }); @@ -179,7 +183,7 @@ describe('TaskListCloudComponent', () => { it('should hide columns on applying new columns visibility through columns selector', () => { component.showMainDatatableActions = true; - spyOn(taskListCloudService, 'getTaskByRequest').and.returnValue(of(fakeGlobalTasks)); + getTaskByRequestSpy.and.returnValue(of(fakeGlobalTasks)); component.ngAfterContentInit(); const appName = new SimpleChange(null, 'FAKE-APP-NAME', true); @@ -210,7 +214,7 @@ describe('TaskListCloudComponent', () => { }); it('should return the results if an application name is given', (done) => { - spyOn(taskListCloudService, 'getTaskByRequest').and.returnValue(of(fakeGlobalTasks)); + getTaskByRequestSpy.and.returnValue(of(fakeGlobalTasks)); component.success.subscribe((res) => { expect(res).toBeDefined(); @@ -234,7 +238,6 @@ describe('TaskListCloudComponent', () => { }); it('should call endpoint when a column visibility gets changed', () => { - spyOn(taskListCloudService, 'getTaskByRequest'); component.ngAfterContentInit(); spyOn(component, 'createDatatableSchema'); component.appName = 'fake-app-name'; @@ -245,8 +248,9 @@ describe('TaskListCloudComponent', () => { fixture.detectChanges(); - expect(taskListCloudService.getTaskByRequest).toHaveBeenCalledTimes(1); + expect(getTaskByRequestSpy).toHaveBeenCalledTimes(1); }); + describe('component changes', () => { beforeEach(() => { component.rows = fakeGlobalTasks.list.entries; @@ -254,7 +258,7 @@ describe('TaskListCloudComponent', () => { }); it('should reload the task list when input parameters changed', () => { - const getTaskByRequestSpy = spyOn(taskListCloudService, 'getTaskByRequest').and.returnValue(of(fakeGlobalTasks)); + getTaskByRequestSpy.and.returnValue(of(fakeGlobalTasks)); component.appName = 'mock-app-name'; component.priority = 1; component.status = 'mock-status'; @@ -279,7 +283,7 @@ describe('TaskListCloudComponent', () => { }); it('should reload task list when sorting on a column changes', () => { - const getTaskByRequestSpy = spyOn(taskListCloudService, 'getTaskByRequest').and.returnValue(of(fakeGlobalTasks)); + getTaskByRequestSpy.and.returnValue(of(fakeGlobalTasks)); component.onSortingChanged( new CustomEvent('sorting-changed', { detail: { @@ -310,7 +314,6 @@ describe('TaskListCloudComponent', () => { }); it('should load spinner and show the content', async () => { - spyOn(taskListCloudService, 'fetchTaskList').and.returnValue(of(fakeGlobalTasks)); const appName = new SimpleChange(null, 'FAKE-APP-NAME', true); fixture.detectChanges(); @@ -327,7 +330,6 @@ describe('TaskListCloudComponent', () => { it('should hide columns on applying new columns visibility through columns selector', () => { component.showMainDatatableActions = true; - spyOn(taskListCloudService, 'fetchTaskList').and.returnValue(of(fakeGlobalTasks)); component.ngAfterContentInit(); const appName = new SimpleChange(null, 'FAKE-APP-NAME', true); @@ -358,8 +360,6 @@ describe('TaskListCloudComponent', () => { }); it('should return the results if an application name is given', (done) => { - spyOn(taskListCloudService, 'fetchTaskList').and.returnValue(of(fakeGlobalTasks)); - component.success.subscribe((res) => { expect(res).toBeDefined(); expect(component.rows).toBeDefined(); @@ -382,7 +382,6 @@ describe('TaskListCloudComponent', () => { }); it('should call endpoint when a column visibility gets changed', () => { - const fetchTaskListSpy = spyOn(taskListCloudService, 'fetchTaskList').and.returnValue(of(fakeGlobalTasks)); component.ngAfterContentInit(); spyOn(component, 'createDatatableSchema'); component.appName = 'fake-app-name'; @@ -403,7 +402,6 @@ describe('TaskListCloudComponent', () => { }); it('should reload the task list when input parameters changed', () => { - const fetchTaskListSpy = spyOn(taskListCloudService, 'fetchTaskList').and.returnValue(of(fakeGlobalTasks)); component.appName = 'mock-app-name'; component.priorities = ['1', '2']; component.statuses = ['mock-status-1', 'mock-status-2']; @@ -422,7 +420,6 @@ describe('TaskListCloudComponent', () => { }); it('should reload task list when sorting on a column changes', () => { - const fetchTaskListSpy = spyOn(taskListCloudService, 'fetchTaskList').and.returnValue(of(fakeGlobalTasks)); fixture.detectChanges(); component.onSortingChanged( new CustomEvent('sorting-changed', { @@ -466,7 +463,7 @@ describe('TaskListCloudComponent', () => { it('should display empty content when process list is empty', async () => { const emptyList = { list: { entries: [] } }; - spyOn(taskListCloudService, 'getTaskByRequest').and.returnValue(of(emptyList)); + getTaskByRequestSpy.and.returnValue(of(emptyList)); fixture.detectChanges(); const appName = new SimpleChange(null, 'FAKE-APP-NAME', true); @@ -595,14 +592,13 @@ describe('TaskListCloudComponent', () => { }); it('should NOT reload the task list when no parameters changed', () => { - spyOn(taskListCloudService, 'getTaskByRequest'); component.rows = null; fixture.detectChanges(); expect(component.isListEmpty()).toBeTruthy(); }); it('should set formattedSorting if sorting input changes', () => { - spyOn(taskListCloudService, 'getTaskByRequest').and.returnValue(of(fakeGlobalTasks)); + getTaskByRequestSpy.and.returnValue(of(fakeGlobalTasks)); spyOn(component, 'formatSorting').and.callThrough(); component.appName = 'mock-app-name'; @@ -622,7 +618,7 @@ describe('TaskListCloudComponent', () => { }); it('should reset pagination when resetPaginationValues is called', (done) => { - spyOn(taskListCloudService, 'getTaskByRequest').and.returnValue(of(fakeGlobalTasks)); + getTaskByRequestSpy.and.returnValue(of(fakeGlobalTasks)); const size = component.size; const skipCount = component.skipCount; @@ -645,7 +641,7 @@ describe('TaskListCloudComponent', () => { }); it('should set pagination and reload when updatePagination is called', (done) => { - spyOn(taskListCloudService, 'getTaskByRequest').and.returnValue(of(fakeGlobalTasks)); + getTaskByRequestSpy.and.returnValue(of(fakeGlobalTasks)); spyOn(component, 'reload').and.stub(); const pagination = { @@ -672,13 +668,13 @@ describe('TaskListCloudComponent: Injecting custom colums for tasklist - CustomT let componentCustom: CustomTaskListComponent; let customCopyComponent: CustomCopyContentTaskListComponent; let copyFixture: ComponentFixture; - let taskListCloudService: TaskListCloudServiceInterface; beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule, CustomTaskListComponent, CustomCopyContentTaskListComponent] + imports: [NoopAuthModule, CustomTaskListComponent, CustomCopyContentTaskListComponent], + providers: [provideCloudPreferences(), { provide: TASK_LIST_CLOUD_TOKEN, useClass: TaskListCloudService }] }); - taskListCloudService = TestBed.inject(TASK_LIST_CLOUD_TOKEN); + const taskListCloudService = TestBed.inject(TASK_LIST_CLOUD_TOKEN); spyOn(taskListCloudService, 'getTaskByRequest').and.returnValue(of(fakeGlobalTasks)); spyOn(taskListCloudService, 'fetchTaskList').and.returnValue(of(fakeGlobalTasks)); fixtureCustom = TestBed.createComponent(CustomTaskListComponent); @@ -726,13 +722,13 @@ describe('TaskListCloudComponent: Injecting custom colums for tasklist - CustomT describe('TaskListCloudComponent: Creating an empty custom template - EmptyTemplateComponent', () => { let fixtureEmpty: ComponentFixture; - let taskListCloudService: TaskListCloudServiceInterface; beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule, TaskListCloudModule] + imports: [NoopAuthModule, EmptyTemplateComponent], + providers: [provideCloudPreferences(), { provide: TASK_LIST_CLOUD_TOKEN, useClass: TaskListCloudService }] }); - taskListCloudService = TestBed.inject(TASK_LIST_CLOUD_TOKEN); + const taskListCloudService = TestBed.inject(TASK_LIST_CLOUD_TOKEN); const emptyList = { list: { entries: [] } }; spyOn(taskListCloudService, 'getTaskByRequest').and.returnValue(of(emptyList)); spyOn(taskListCloudService, 'fetchTaskList').and.returnValue(of(fakeGlobalTasks)); @@ -758,16 +754,16 @@ describe('TaskListCloudComponent: Copy cell content directive from app.config sp let getTaskByRequestSpy: jasmine.Spy; let fetchTaskListSpy: jasmine.Spy; let appConfig: AppConfigService; - let taskListCloudService: TaskListCloudServiceInterface; let component: TaskListCloudComponent; let fixture: ComponentFixture; beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule] + imports: [NoopAuthModule, TaskListCloudComponent], + providers: [provideCloudPreferences(), { provide: TASK_LIST_CLOUD_TOKEN, useClass: TaskListCloudService }] }); appConfig = TestBed.inject(AppConfigService); - taskListCloudService = TestBed.inject(TASK_LIST_CLOUD_TOKEN); + const taskListCloudService = TestBed.inject(TASK_LIST_CLOUD_TOKEN); appConfig.config = Object.assign(appConfig.config, { 'adf-cloud-task-list': { presets: { diff --git a/lib/process-services-cloud/src/lib/task/task-list/services/service-task-list-cloud.service.spec.ts b/lib/process-services-cloud/src/lib/task/task-list/services/service-task-list-cloud.service.spec.ts index 90cac7605d..ff4675d8ba 100644 --- a/lib/process-services-cloud/src/lib/task/task-list/services/service-task-list-cloud.service.spec.ts +++ b/lib/process-services-cloud/src/lib/task/task-list/services/service-task-list-cloud.service.spec.ts @@ -18,9 +18,9 @@ import { TestBed } from '@angular/core/testing'; import { ServiceTaskListCloudService } from './service-task-list-cloud.service'; import { ServiceTaskQueryCloudRequestModel } from '../models/service-task-cloud.model'; -import { ProcessServiceCloudTestingModule } from '../../../testing/process-service-cloud.testing.module'; import { of } from 'rxjs'; import { AdfHttpClient } from '@alfresco/adf-core/api'; +import { NoopTranslateModule } from '@alfresco/adf-core'; describe('Activiti ServiceTaskList Cloud Service', () => { let service: ServiceTaskListCloudService; @@ -33,7 +33,7 @@ describe('Activiti ServiceTaskList Cloud Service', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule] + imports: [NoopTranslateModule] }); adfHttpClient = TestBed.inject(AdfHttpClient); service = TestBed.inject(ServiceTaskListCloudService); diff --git a/lib/process-services-cloud/src/lib/task/task-list/services/task-list-cloud.service.spec.ts b/lib/process-services-cloud/src/lib/task/task-list/services/task-list-cloud.service.spec.ts index 03b43e7790..1eb8a1ade1 100644 --- a/lib/process-services-cloud/src/lib/task/task-list/services/task-list-cloud.service.spec.ts +++ b/lib/process-services-cloud/src/lib/task/task-list/services/task-list-cloud.service.spec.ts @@ -18,9 +18,9 @@ import { TestBed } from '@angular/core/testing'; import { TaskListCloudService } from './task-list-cloud.service'; import { TaskListRequestModel, TaskQueryCloudRequestModel } from '../../../models/filter-cloud-model'; -import { ProcessServiceCloudTestingModule } from '../../../testing/process-service-cloud.testing.module'; import { AdfHttpClient } from '@alfresco/adf-core/api'; import { catchError, firstValueFrom, of } from 'rxjs'; +import { NoopTranslateModule } from '@alfresco/adf-core'; describe('TaskListCloudService', () => { let service: TaskListCloudService; @@ -33,7 +33,7 @@ describe('TaskListCloudService', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessServiceCloudTestingModule] + imports: [NoopTranslateModule] }); adfHttpClient = TestBed.inject(AdfHttpClient); service = TestBed.inject(TaskListCloudService); diff --git a/lib/process-services-cloud/src/lib/task/task-list/task-list-cloud.module.ts b/lib/process-services-cloud/src/lib/task/task-list/task-list-cloud.module.ts index 627971d26c..8add95e0ef 100644 --- a/lib/process-services-cloud/src/lib/task/task-list/task-list-cloud.module.ts +++ b/lib/process-services-cloud/src/lib/task/task-list/task-list-cloud.module.ts @@ -18,25 +18,12 @@ import { NgModule } from '@angular/core'; import { TaskListCloudComponent } from './components/task-list/task-list-cloud.component'; import { ServiceTaskListCloudComponent } from './components/service-task-list/service-task-list-cloud.component'; -import { TASK_LIST_CLOUD_TOKEN, TASK_LIST_PREFERENCES_SERVICE_TOKEN } from '../../services/cloud-token.service'; -import { TaskListCloudService } from './services/task-list-cloud.service'; -import { LocalPreferenceCloudService } from '../../services/local-preference-cloud.service'; export const TASK_LIST_CLOUD_DIRECTIVES = [TaskListCloudComponent, ServiceTaskListCloudComponent] as const; /** @deprecated use standalone components or TASK_LIST_CLOUD_DIRECTIVES instead */ @NgModule({ imports: [...TASK_LIST_CLOUD_DIRECTIVES], - exports: [...TASK_LIST_CLOUD_DIRECTIVES], - providers: [ - { - provide: TASK_LIST_CLOUD_TOKEN, - useClass: TaskListCloudService - }, - { - provide: TASK_LIST_PREFERENCES_SERVICE_TOKEN, - useClass: LocalPreferenceCloudService - } - ] + exports: [...TASK_LIST_CLOUD_DIRECTIVES] }) export class TaskListCloudModule {} diff --git a/lib/process-services/src/lib/testing/process.testing.module.ts b/lib/process-services-cloud/src/lib/testing/global-testing.module.ts similarity index 52% rename from lib/process-services/src/lib/testing/process.testing.module.ts rename to lib/process-services-cloud/src/lib/testing/global-testing.module.ts index 9507ca9c82..c15f70ad1e 100644 --- a/lib/process-services/src/lib/testing/process.testing.module.ts +++ b/lib/process-services-cloud/src/lib/testing/global-testing.module.ts @@ -15,19 +15,12 @@ * limitations under the License. */ +import { BrowserDynamicTestingModule } from '@angular/platform-browser-dynamic/testing'; +import { NoopTranslateModule } from '@alfresco/adf-core'; import { NgModule } from '@angular/core'; import { NoopAnimationsModule } from '@angular/platform-browser/animations'; -import { ProcessModule } from '../process.module'; -import { CoreModule, FormRenderingService, NoopTranslateModule, NoopAuthModule } from '@alfresco/adf-core'; -import { ProcessFormRenderingService } from '../form/process-form-rendering.service'; -import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services'; @NgModule({ - imports: [CoreModule.forRoot(), ProcessModule.forRoot(), NoopAuthModule, NoopAnimationsModule, NoopTranslateModule], - providers: [ - { provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }, - { provide: FormRenderingService, useClass: ProcessFormRenderingService } - ], - exports: [CoreModule, ProcessModule] + imports: [BrowserDynamicTestingModule, NoopTranslateModule, NoopAnimationsModule] }) -export class ProcessTestingModule {} +export class GlobalTestingModule {} diff --git a/lib/process-services-cloud/src/lib/testing/process-service-cloud.testing.module.ts b/lib/process-services-cloud/src/lib/testing/process-service-cloud.testing.module.ts deleted file mode 100644 index 0b5f1a668b..0000000000 --- a/lib/process-services-cloud/src/lib/testing/process-service-cloud.testing.module.ts +++ /dev/null @@ -1,54 +0,0 @@ -/*! - * @license - * Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { NgModule } from '@angular/core'; -import { NoopAnimationsModule } from '@angular/platform-browser/animations'; -import { HttpClientModule } from '@angular/common/http'; -import { - AppConfigService, - AppConfigServiceMock, - TranslationService, - TranslationMock, - CoreModule, - AuthModule, - JWT_STORAGE_SERVICE, - StorageService -} from '@alfresco/adf-core'; -import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services'; -import { TranslateModule } from '@ngx-translate/core'; -import { ProcessServicesCloudModule } from '../process-services-cloud.module'; -import { RouterTestingModule } from '@angular/router/testing'; - -@NgModule({ - imports: [ - AuthModule.forRoot({ useHash: true }), - HttpClientModule, - NoopAnimationsModule, - RouterTestingModule, - TranslateModule.forRoot(), - CoreModule.forRoot(), - ProcessServicesCloudModule.forRoot() - ], - providers: [ - { provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }, - { provide: AppConfigService, useClass: AppConfigServiceMock }, - { provide: TranslationService, useClass: TranslationMock }, - { provide: JWT_STORAGE_SERVICE, useClass: StorageService } - ], - exports: [NoopAnimationsModule, TranslateModule, CoreModule, ProcessServicesCloudModule] -}) -export class ProcessServiceCloudTestingModule {} diff --git a/lib/process-services-cloud/src/public-api.ts b/lib/process-services-cloud/src/public-api.ts index bd582963aa..5e4fa8961e 100644 --- a/lib/process-services-cloud/src/public-api.ts +++ b/lib/process-services-cloud/src/public-api.ts @@ -39,3 +39,4 @@ export * from './lib/models/process-instance-variable.model'; export * from './lib/models/variable-definition'; export * from './lib/models/date-format-cloud.model'; export * from './lib/models/process-variable-filter.model'; +export * from './lib/providers'; diff --git a/lib/process-services-cloud/src/test.ts b/lib/process-services-cloud/src/test.ts index 7cb6c19c91..58fd9755c6 100644 --- a/lib/process-services-cloud/src/test.ts +++ b/lib/process-services-cloud/src/test.ts @@ -15,14 +15,12 @@ * limitations under the License. */ -// This file is required by karma.conf.js and loads recursively all the .spec and framework files - import 'zone.js'; import 'zone.js/testing'; -import { getTestBed } from '@angular/core/testing'; -import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing'; +import { TestBed } from '@angular/core/testing'; +import { platformBrowserDynamicTesting } from '@angular/platform-browser-dynamic/testing'; +import { GlobalTestingModule } from './lib/testing/global-testing.module'; -// First, initialize the Angular testing environment. -getTestBed().initTestEnvironment(BrowserDynamicTestingModule, platformBrowserDynamicTesting(), { +TestBed.initTestEnvironment(GlobalTestingModule, platformBrowserDynamicTesting(), { teardown: { destroyAfterEach: true } }); diff --git a/lib/process-services/src/lib/app-list/apps-list.component.spec.ts b/lib/process-services/src/lib/app-list/apps-list.component.spec.ts index 4b1f40016b..abb6d4c2ac 100644 --- a/lib/process-services/src/lib/app-list/apps-list.component.spec.ts +++ b/lib/process-services/src/lib/app-list/apps-list.component.spec.ts @@ -22,7 +22,6 @@ import { AppsProcessService } from '../services/apps-process.service'; import { of, throwError } from 'rxjs'; import { defaultApp, deployedApps, nonDeployedApps } from '../testing/mock/apps-list.mock'; import { AppsListComponent, APP_LIST_LAYOUT_GRID, APP_LIST_LAYOUT_LIST } from './apps-list.component'; -import { ProcessTestingModule } from '../testing/process.testing.module'; import { HarnessLoader } from '@angular/cdk/testing'; import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed'; import { MatProgressSpinnerHarness } from '@angular/material/progress-spinner/testing'; @@ -51,7 +50,7 @@ describe('AppsListComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessTestingModule, CustomEmptyAppListTemplateComponent] + imports: [CustomEmptyAppListTemplateComponent] }); fixture = TestBed.createComponent(AppsListComponent); component = fixture.componentInstance; diff --git a/lib/process-services/src/lib/app-list/select-apps-dialog/select-apps-dialog.component.spec.ts b/lib/process-services/src/lib/app-list/select-apps-dialog/select-apps-dialog.component.spec.ts index 5891615e94..2a0c765594 100644 --- a/lib/process-services/src/lib/app-list/select-apps-dialog/select-apps-dialog.component.spec.ts +++ b/lib/process-services/src/lib/app-list/select-apps-dialog/select-apps-dialog.component.spec.ts @@ -23,7 +23,6 @@ import { AppsProcessService } from '../../services/apps-process.service'; import { deployedApps } from '../../testing/mock/apps-list.mock'; import { of } from 'rxjs'; import { SelectAppsDialogComponent } from './select-apps-dialog.component'; -import { ProcessTestingModule } from '../../testing/process.testing.module'; @Component({ selector: 'adf-dialog-test', @@ -57,7 +56,7 @@ describe('Select app dialog', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessTestingModule, DialogSelectAppTestComponent], + imports: [DialogSelectAppTestComponent], providers: [ { provide: OverlayContainer, diff --git a/lib/process-services/src/lib/attachment/create-process-attachment/create-process-attachment.component.spec.ts b/lib/process-services/src/lib/attachment/create-process-attachment/create-process-attachment.component.spec.ts index c82099174e..eaa8a5d1b1 100644 --- a/lib/process-services/src/lib/attachment/create-process-attachment/create-process-attachment.component.spec.ts +++ b/lib/process-services/src/lib/attachment/create-process-attachment/create-process-attachment.component.spec.ts @@ -18,7 +18,6 @@ import { SimpleChange } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { CreateProcessAttachmentComponent } from './create-process-attachment.component'; -import { ProcessTestingModule } from '../../testing/process.testing.module'; import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services'; declare let jasmine: any; @@ -48,7 +47,7 @@ describe('CreateProcessAttachmentComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessTestingModule, CreateProcessAttachmentComponent], + imports: [CreateProcessAttachmentComponent], providers: [{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }] }); fixture = TestBed.createComponent(CreateProcessAttachmentComponent); diff --git a/lib/process-services/src/lib/attachment/create-task-attachment/create-task-attachment.component.spec.ts b/lib/process-services/src/lib/attachment/create-task-attachment/create-task-attachment.component.spec.ts index 0a89c03516..903f75e464 100644 --- a/lib/process-services/src/lib/attachment/create-task-attachment/create-task-attachment.component.spec.ts +++ b/lib/process-services/src/lib/attachment/create-task-attachment/create-task-attachment.component.spec.ts @@ -19,7 +19,6 @@ import { SimpleChange } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { of } from 'rxjs'; import { AttachmentComponent } from './create-task-attachment.component'; -import { ProcessTestingModule } from '../../testing/process.testing.module'; import { ProcessContentService } from '../../form/services/process-content.service'; describe('AttachmentComponent', () => { @@ -30,7 +29,7 @@ describe('AttachmentComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessTestingModule, AttachmentComponent] + imports: [AttachmentComponent] }); fixture = TestBed.createComponent(AttachmentComponent); component = fixture.componentInstance; diff --git a/lib/process-services/src/lib/attachment/process-attachment-list/process-attachment-list.component.spec.ts b/lib/process-services/src/lib/attachment/process-attachment-list/process-attachment-list.component.spec.ts index 0af5d98c64..44cff30356 100644 --- a/lib/process-services/src/lib/attachment/process-attachment-list/process-attachment-list.component.spec.ts +++ b/lib/process-services/src/lib/attachment/process-attachment-list/process-attachment-list.component.spec.ts @@ -20,7 +20,6 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { of, throwError } from 'rxjs'; import { ProcessAttachmentListComponent } from './process-attachment-list.component'; -import { ProcessTestingModule } from '../../testing/process.testing.module'; import { mockEmittedProcessAttachments, mockProcessAttachments } from '../../testing/mock/process/process-attachments.mock'; import { ProcessContentService } from '../../form/services/process-content.service'; import { HarnessLoader } from '@angular/cdk/testing'; @@ -37,7 +36,7 @@ describe('ProcessAttachmentListComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessTestingModule, ProcessAttachmentListComponent] + imports: [ProcessAttachmentListComponent] }); fixture = TestBed.createComponent(ProcessAttachmentListComponent); component = fixture.componentInstance; @@ -256,7 +255,7 @@ describe('Custom CustomEmptyTemplateComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessTestingModule, CustomEmptyTemplateComponent] + imports: [CustomEmptyTemplateComponent] }); fixture = TestBed.createComponent(CustomEmptyTemplateComponent); fixture.detectChanges(); diff --git a/lib/process-services/src/lib/attachment/task-attachment-list/task-attachment-list.component.spec.ts b/lib/process-services/src/lib/attachment/task-attachment-list/task-attachment-list.component.spec.ts index c87be473a0..dc0aaf3dab 100644 --- a/lib/process-services/src/lib/attachment/task-attachment-list/task-attachment-list.component.spec.ts +++ b/lib/process-services/src/lib/attachment/task-attachment-list/task-attachment-list.component.spec.ts @@ -20,7 +20,6 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { of, throwError } from 'rxjs'; import { TaskAttachmentListComponent } from './task-attachment-list.component'; -import { ProcessTestingModule } from '../../testing/process.testing.module'; import { mockEmittedTaskAttachments, mockTaskAttachments } from '../../testing/mock/task/task-attachments.mock'; import { ProcessContentService } from '../../form/services/process-content.service'; import { HarnessLoader } from '@angular/cdk/testing'; @@ -40,7 +39,7 @@ describe('TaskAttachmentList', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessTestingModule, TaskAttachmentListComponent] + imports: [TaskAttachmentListComponent] }); fixture = TestBed.createComponent(TaskAttachmentListComponent); component = fixture.componentInstance; @@ -297,7 +296,6 @@ describe('Custom CustomEmptyTemplateComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessTestingModule], declarations: [CustomEmptyTemplateComponent], schemas: [CUSTOM_ELEMENTS_SCHEMA] }); diff --git a/lib/process-services/src/lib/form/form-list/form-list.component.spec.ts b/lib/process-services/src/lib/form/form-list/form-list.component.spec.ts index 9af0c95c4c..85e6752572 100644 --- a/lib/process-services/src/lib/form/form-list/form-list.component.spec.ts +++ b/lib/process-services/src/lib/form/form-list/form-list.component.spec.ts @@ -17,7 +17,6 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { of } from 'rxjs'; -import { CoreTestingModule } from '@alfresco/adf-core'; import { FormListComponent } from './form-list.component'; import { ModelService } from '../services/model.service'; @@ -29,7 +28,7 @@ describe('TaskAttachmentList', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule, FormListComponent] + imports: [FormListComponent] }); fixture = TestBed.createComponent(FormListComponent); component = fixture.componentInstance; diff --git a/lib/process-services/src/lib/form/form.component.spec.ts b/lib/process-services/src/lib/form/form.component.spec.ts index 86c8e2bba6..05396fe8c9 100644 --- a/lib/process-services/src/lib/form/form.component.spec.ts +++ b/lib/process-services/src/lib/form/form.component.spec.ts @@ -29,18 +29,18 @@ import { FormService, WidgetVisibilityService, ContainerModel, - fakeForm + fakeForm, + NoopAuthModule } from '@alfresco/adf-core'; import { NodeMetadata, NodesApiService } from '@alfresco/adf-content-services'; import { FormComponent } from './form.component'; import { ProcessFormRenderingService } from './process-form-rendering.service'; -import { ProcessTestingModule } from '../testing/process.testing.module'; import { TaskFormService } from './services/task-form.service'; import { TaskService } from './services/task.service'; import { EditorService } from './services/editor.service'; import { ModelService } from './services/model.service'; -import { FormCustomOutcomesComponent } from '@alfresco/adf-process-services'; import { MatButtonModule } from '@angular/material/button'; +import { FormCustomOutcomesComponent } from './form-custom-outcomes.component'; describe('FormComponent', () => { let fixture: ComponentFixture; @@ -84,7 +84,7 @@ describe('FormComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessTestingModule, CustomUploadModule] + imports: [NoopAuthModule, CustomUploadModule] }); visibilityService = TestBed.inject(WidgetVisibilityService); spyOn(visibilityService, 'refreshVisibility').and.stub(); @@ -1012,7 +1012,7 @@ describe('FormWithCustomOutComesComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessTestingModule, FormWithCustomOutComesComponent] + imports: [FormWithCustomOutComesComponent] }); fixture = TestBed.createComponent(FormWithCustomOutComesComponent); customComponent = fixture.componentInstance; diff --git a/lib/process-services/src/lib/form/form.component.visibility.spec.ts b/lib/process-services/src/lib/form/form.component.visibility.spec.ts index 52127862bb..9d11f3c65c 100644 --- a/lib/process-services/src/lib/form/form.component.visibility.spec.ts +++ b/lib/process-services/src/lib/form/form.component.visibility.spec.ts @@ -15,28 +15,26 @@ * limitations under the License. */ -import { CUSTOM_ELEMENTS_SCHEMA, SimpleChange } from '@angular/core'; +import { SimpleChange } from '@angular/core'; import { of } from 'rxjs'; - import { ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; - import { formDefinitionDropdownField, formDefinitionTwoTextFields, formDefinitionRequiredField, formDefVisibilityFieldDependsOnNextOne, formDefVisibilitiFieldDependsOnPreviousOne, - formReadonlyTwoTextFields + formReadonlyTwoTextFields, + FormRenderingService } from '@alfresco/adf-core'; import { FormComponent } from './form.component'; -import { ProcessTestingModule } from '../testing/process.testing.module'; import { TaskService } from './services/task.service'; import { TaskFormService } from './services/task-form.service'; -import { TaskRepresentation } from '@alfresco/js-api'; import { HarnessLoader } from '@angular/cdk/testing'; import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed'; import { MatSelectHarness } from '@angular/material/select/testing'; +import { ProcessFormRenderingService } from './process-form-rendering.service'; describe('FormComponent UI and visibility', () => { let component: FormComponent; @@ -44,17 +42,21 @@ describe('FormComponent UI and visibility', () => { let taskFormService: TaskFormService; let fixture: ComponentFixture; let loader: HarnessLoader; + let getTaskFormSpy: jasmine.Spy; beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessTestingModule], - schemas: [CUSTOM_ELEMENTS_SCHEMA] + imports: [FormComponent], + providers: [FormRenderingService, { provide: FormRenderingService, useClass: ProcessFormRenderingService }] }); fixture = TestBed.createComponent(FormComponent); component = fixture.componentInstance; loader = TestbedHarnessEnvironment.loader(fixture); - taskService = TestBed.inject(TaskService); taskFormService = TestBed.inject(TaskFormService); + + taskService = TestBed.inject(TaskService); + spyOn(taskService, 'getTask').and.returnValue(of({} as any)); + getTaskFormSpy = spyOn(taskFormService, 'getTaskForm'); }); afterEach(() => { @@ -63,8 +65,7 @@ describe('FormComponent UI and visibility', () => { describe('Validation icon', () => { it('should display valid icon for valid form', () => { - spyOn(taskService, 'getTask').and.returnValue(of({} as TaskRepresentation)); - spyOn(taskFormService, 'getTaskForm').and.returnValue(of(formDefinitionTwoTextFields)); + getTaskFormSpy.and.returnValue(of(formDefinitionTwoTextFields)); const change = new SimpleChange(null, 1, true); component.ngOnChanges({ taskId: change }); @@ -75,8 +76,7 @@ describe('FormComponent UI and visibility', () => { }); it('should display invalid icon for valid form', () => { - spyOn(taskService, 'getTask').and.returnValue(of({} as TaskRepresentation)); - spyOn(taskFormService, 'getTaskForm').and.returnValue(of(formDefinitionRequiredField)); + getTaskFormSpy.and.returnValue(of(formDefinitionRequiredField)); const change = new SimpleChange(null, 1, true); component.ngOnChanges({ taskId: change }); @@ -87,8 +87,7 @@ describe('FormComponent UI and visibility', () => { }); it('should NOT display validation icon when [showValidationIcon] is false', () => { - spyOn(taskService, 'getTask').and.returnValue(of({} as TaskRepresentation)); - spyOn(taskFormService, 'getTaskForm').and.returnValue(of(formDefinitionTwoTextFields)); + getTaskFormSpy.and.returnValue(of(formDefinitionTwoTextFields)); const change = new SimpleChange(null, 1, true); component.ngOnChanges({ taskId: change }); @@ -101,8 +100,7 @@ describe('FormComponent UI and visibility', () => { describe('form definition', () => { it('should display two text fields form definition', () => { - spyOn(taskService, 'getTask').and.returnValue(of({} as TaskRepresentation)); - spyOn(taskFormService, 'getTaskForm').and.returnValue(of(formDefinitionTwoTextFields)); + getTaskFormSpy.and.returnValue(of(formDefinitionTwoTextFields)); const change = new SimpleChange(null, 1, true); component.ngOnChanges({ taskId: change }); @@ -118,8 +116,7 @@ describe('FormComponent UI and visibility', () => { }); it('should display dropdown field', async () => { - spyOn(taskService, 'getTask').and.returnValue(of({} as TaskRepresentation)); - spyOn(taskFormService, 'getTaskForm').and.returnValue(of(formDefinitionDropdownField)); + getTaskFormSpy.and.returnValue(of(formDefinitionDropdownField)); const change = new SimpleChange(null, 1, true); component.ngOnChanges({ taskId: change }); @@ -144,8 +141,7 @@ describe('FormComponent UI and visibility', () => { describe('Visibility conditions', () => { it('should hide the field based on the next one', () => { - spyOn(taskService, 'getTask').and.returnValue(of({} as TaskRepresentation)); - spyOn(taskFormService, 'getTaskForm').and.returnValue(of(formDefVisibilityFieldDependsOnNextOne)); + getTaskFormSpy.and.returnValue(of(formDefVisibilityFieldDependsOnNextOne)); const change = new SimpleChange(null, 1, true); component.ngOnChanges({ taskId: change }); @@ -161,8 +157,7 @@ describe('FormComponent UI and visibility', () => { }); it('should hide the field based on the previous one', () => { - spyOn(taskService, 'getTask').and.returnValue(of({} as TaskRepresentation)); - spyOn(taskFormService, 'getTaskForm').and.returnValue(of(formDefVisibilitiFieldDependsOnPreviousOne)); + getTaskFormSpy.and.returnValue(of(formDefVisibilitiFieldDependsOnPreviousOne)); const change = new SimpleChange(null, 1, true); component.ngOnChanges({ taskId: change }); @@ -178,8 +173,7 @@ describe('FormComponent UI and visibility', () => { }); it('should show the hidden field when the visibility condition change to true', () => { - spyOn(taskService, 'getTask').and.returnValue(of({} as TaskRepresentation)); - spyOn(taskFormService, 'getTaskForm').and.returnValue(of(formDefVisibilityFieldDependsOnNextOne)); + getTaskFormSpy.and.returnValue(of(formDefVisibilityFieldDependsOnNextOne)); const change = new SimpleChange(null, 1, true); component.ngOnChanges({ taskId: change }); @@ -203,8 +197,7 @@ describe('FormComponent UI and visibility', () => { describe('Readonly Form', () => { it('should display two text fields readonly', async () => { - spyOn(taskService, 'getTask').and.returnValue(of({} as TaskRepresentation)); - spyOn(taskFormService, 'getTaskForm').and.returnValue(of(formReadonlyTwoTextFields)); + getTaskFormSpy.and.returnValue(of(formReadonlyTwoTextFields)); const change = new SimpleChange(null, 1, true); component.ngOnChanges({ taskId: change }); diff --git a/lib/process-services/src/lib/form/services/ecm-model.service.spec.ts b/lib/process-services/src/lib/form/services/ecm-model.service.spec.ts index 51d5c8abc4..16b55cc91f 100644 --- a/lib/process-services/src/lib/form/services/ecm-model.service.spec.ts +++ b/lib/process-services/src/lib/form/services/ecm-model.service.spec.ts @@ -16,7 +16,7 @@ */ import { Observable } from 'rxjs'; -import { FormModel, CoreTestingModule } from '@alfresco/adf-core'; +import { FormModel } from '@alfresco/adf-core'; import { EcmModelService } from './ecm-model.service'; import { TestBed } from '@angular/core/testing'; import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services'; @@ -28,7 +28,7 @@ describe('EcmModelService', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule], + imports: [], providers: [{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }] }); service = TestBed.inject(EcmModelService); diff --git a/lib/process-services/src/lib/form/services/process-content.service.spec.ts b/lib/process-services/src/lib/form/services/process-content.service.spec.ts index dcfad50ea8..9bbfcbad44 100644 --- a/lib/process-services/src/lib/form/services/process-content.service.spec.ts +++ b/lib/process-services/src/lib/form/services/process-content.service.spec.ts @@ -17,7 +17,6 @@ import { TestBed } from '@angular/core/testing'; import { ProcessContentService } from './process-content.service'; -import { CoreTestingModule } from '@alfresco/adf-core'; import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services'; declare let jasmine: any; @@ -66,7 +65,7 @@ describe('ProcessContentService', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule], + imports: [], providers: [{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }] }); service = TestBed.inject(ProcessContentService); diff --git a/lib/process-services/src/lib/form/start-form/start-form.component.spec.ts b/lib/process-services/src/lib/form/start-form/start-form.component.spec.ts index abf9a8ab48..1448fc8507 100644 --- a/lib/process-services/src/lib/form/start-form/start-form.component.spec.ts +++ b/lib/process-services/src/lib/form/start-form/start-form.component.spec.ts @@ -15,7 +15,7 @@ * limitations under the License. */ -import { CUSTOM_ELEMENTS_SCHEMA, SimpleChange } from '@angular/core'; +import { SimpleChange } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { of } from 'rxjs'; import { @@ -33,15 +33,15 @@ import { preselectedMultipleNodes } from './start-form.component.mock'; import { StartFormComponent } from './start-form.component'; -import { WidgetVisibilityService, FormModel, FormOutcomeModel } from '@alfresco/adf-core'; +import { WidgetVisibilityService, FormModel, FormOutcomeModel, FormRenderingService } from '@alfresco/adf-core'; import { TranslateService } from '@ngx-translate/core'; -import { ProcessTestingModule } from '../../testing/process.testing.module'; import { ProcessService } from '../../process-list/services/process.service'; import { HarnessLoader } from '@angular/cdk/testing'; import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed'; import { MatSelectHarness } from '@angular/material/select/testing'; import { MatCardHarness } from '@angular/material/card/testing'; import { MatButtonHarness } from '@angular/material/button/testing'; +import { ProcessFormRenderingService } from '../process-form-rendering.service'; describe('StartFormComponent', () => { let component: StartFormComponent; @@ -57,8 +57,8 @@ describe('StartFormComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessTestingModule], - schemas: [CUSTOM_ELEMENTS_SCHEMA] + imports: [StartFormComponent], + providers: [FormRenderingService, { provide: FormRenderingService, useClass: ProcessFormRenderingService }] }); fixture = TestBed.createComponent(StartFormComponent); component = fixture.componentInstance; diff --git a/lib/process-services/src/lib/form/widgets/content-widget/attach-file-widget-dialog.component.spec.ts b/lib/process-services/src/lib/form/widgets/content-widget/attach-file-widget-dialog.component.spec.ts index 99b1f29bb4..15fc35fcb3 100644 --- a/lib/process-services/src/lib/form/widgets/content-widget/attach-file-widget-dialog.component.spec.ts +++ b/lib/process-services/src/lib/form/widgets/content-widget/attach-file-widget-dialog.component.spec.ts @@ -19,9 +19,8 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog'; import { ContentNodeSelectorPanelComponent, DocumentListService, SitesService, NodesApiService } from '@alfresco/adf-content-services'; import { EventEmitter, NO_ERRORS_SCHEMA } from '@angular/core'; -import { ProcessTestingModule } from '../../../testing/process.testing.module'; import { AttachFileWidgetDialogComponent } from './attach-file-widget-dialog.component'; -import { AuthenticationService } from '@alfresco/adf-core'; +import { AuthenticationService, NoopAuthModule } from '@alfresco/adf-core'; import { AttachFileWidgetDialogComponentData } from './attach-file-widget-dialog-component.interface'; import { of, Subject, throwError } from 'rxjs'; import { By } from '@angular/platform-browser'; @@ -50,7 +49,7 @@ describe('AttachFileWidgetDialogComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessTestingModule, AttachFileWidgetDialogComponent], + imports: [NoopAuthModule, AttachFileWidgetDialogComponent], providers: [ { provide: MAT_DIALOG_DATA, useValue: data }, { provide: MatDialogRef, useValue: { close: () => of() } } diff --git a/lib/process-services/src/lib/form/widgets/content-widget/attach-file-widget-dialog.service.spec.ts b/lib/process-services/src/lib/form/widgets/content-widget/attach-file-widget-dialog.service.spec.ts index 5f6688eb1d..2b3028f9f9 100644 --- a/lib/process-services/src/lib/form/widgets/content-widget/attach-file-widget-dialog.service.spec.ts +++ b/lib/process-services/src/lib/form/widgets/content-widget/attach-file-widget-dialog.service.spec.ts @@ -19,7 +19,6 @@ import { TestBed } from '@angular/core/testing'; import { MatDialog } from '@angular/material/dialog'; import { AttachFileWidgetDialogService } from './attach-file-widget-dialog.service'; import { Subject, of } from 'rxjs'; -import { ProcessTestingModule } from '../../../testing/process.testing.module'; import { AlfrescoEndpointRepresentation } from '@alfresco/js-api'; describe('AttachFileWidgetDialogService', () => { @@ -29,9 +28,6 @@ describe('AttachFileWidgetDialogService', () => { let mockRepository: AlfrescoEndpointRepresentation; beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ProcessTestingModule] - }); service = TestBed.inject(AttachFileWidgetDialogService); materialDialog = TestBed.inject(MatDialog); spyOnDialogOpen = spyOn(materialDialog, 'open').and.returnValue({ diff --git a/lib/process-services/src/lib/form/widgets/content-widget/attach-file-widget.component.spec.ts b/lib/process-services/src/lib/form/widgets/content-widget/attach-file-widget.component.spec.ts index 5f72fe13eb..bdfcfda0fb 100644 --- a/lib/process-services/src/lib/form/widgets/content-widget/attach-file-widget.component.spec.ts +++ b/lib/process-services/src/lib/form/widgets/content-widget/attach-file-widget.component.spec.ts @@ -27,17 +27,16 @@ import { DownloadService, AppConfigService, AppConfigValues, - UnitTestingUtils + UnitTestingUtils, + NoopAuthModule } from '@alfresco/adf-core'; import { ContentNodeDialogService } from '@alfresco/adf-content-services'; import { of } from 'rxjs'; import { Node } from '@alfresco/js-api'; -import { ProcessTestingModule } from '../../../testing/process.testing.module'; import { AttachFileWidgetDialogService } from './attach-file-widget-dialog.service'; import { ActivitiContentService } from '../../services/activiti-alfresco.service'; import { ProcessContentService } from '../../services/process-content.service'; -import { RouterTestingModule } from '@angular/router/testing'; -import { ActivatedRoute, Router } from '@angular/router'; +import { ActivatedRoute, provideRouter, Router } from '@angular/router'; import { HarnessLoader } from '@angular/cdk/testing'; import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed'; import { MatMenuHarness } from '@angular/material/menu/testing'; @@ -164,8 +163,9 @@ describe('AttachFileWidgetComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessTestingModule, AttachFileWidgetComponent, RouterTestingModule], + imports: [NoopAuthModule, AttachFileWidgetComponent], providers: [ + provideRouter([]), { provide: ActivatedRoute, useValue: { diff --git a/lib/process-services/src/lib/form/widgets/content-widget/attach-folder-widget.component.spec.ts b/lib/process-services/src/lib/form/widgets/content-widget/attach-folder-widget.component.spec.ts index 296f3960a0..55ab0005a8 100644 --- a/lib/process-services/src/lib/form/widgets/content-widget/attach-folder-widget.component.spec.ts +++ b/lib/process-services/src/lib/form/widgets/content-widget/attach-folder-widget.component.spec.ts @@ -18,11 +18,10 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { AttachFolderWidgetComponent } from './attach-folder-widget.component'; -import { FormFieldModel, FormModel } from '@alfresco/adf-core'; +import { FormFieldModel, FormModel, NoopAuthModule } from '@alfresco/adf-core'; import { ContentNodeDialogService, NodesApiService } from '@alfresco/adf-content-services'; import { of } from 'rxjs'; import { Node } from '@alfresco/js-api'; -import { ProcessTestingModule } from '../../../testing/process.testing.module'; const fakeNode = { id: 'fake', @@ -49,7 +48,7 @@ describe('AttachFolderWidgetComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessTestingModule, AttachFolderWidgetComponent] + imports: [NoopAuthModule, AttachFolderWidgetComponent] }); fixture = TestBed.createComponent(AttachFolderWidgetComponent); widget = fixture.componentInstance; diff --git a/lib/process-services/src/lib/form/widgets/document/content.widget.spec.ts b/lib/process-services/src/lib/form/widgets/document/content.widget.spec.ts index c636f60d26..b6eb9ef46a 100644 --- a/lib/process-services/src/lib/form/widgets/document/content.widget.spec.ts +++ b/lib/process-services/src/lib/form/widgets/document/content.widget.spec.ts @@ -18,7 +18,7 @@ import { SimpleChange } from '@angular/core'; import { ComponentFixture, fakeAsync, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; -import { ContentLinkModel, CoreTestingModule, DownloadService } from '@alfresco/adf-core'; +import { ContentLinkModel, DownloadService } from '@alfresco/adf-core'; import { of } from 'rxjs'; import { ContentWidgetComponent } from './content.widget'; import { ProcessContentService } from '../../services/process-content.service'; @@ -60,7 +60,7 @@ describe('ContentWidgetComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule, ContentWidgetComponent], + imports: [ContentWidgetComponent], providers: [{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }] }); downloadService = TestBed.inject(DownloadService); diff --git a/lib/process-services/src/lib/form/widgets/dropdown/dropdown.widget.spec.ts b/lib/process-services/src/lib/form/widgets/dropdown/dropdown.widget.spec.ts index f1582c4542..011502504a 100644 --- a/lib/process-services/src/lib/form/widgets/dropdown/dropdown.widget.spec.ts +++ b/lib/process-services/src/lib/form/widgets/dropdown/dropdown.widget.spec.ts @@ -17,15 +17,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { Observable, of } from 'rxjs'; -import { - WidgetVisibilityService, - FormFieldOption, - FormFieldModel, - FormModel, - FormFieldTypes, - CoreTestingModule, - ErrorMessageModel -} from '@alfresco/adf-core'; +import { WidgetVisibilityService, FormFieldOption, FormFieldModel, FormModel, FormFieldTypes, ErrorMessageModel } from '@alfresco/adf-core'; import { DropdownWidgetComponent } from './dropdown.widget'; import { TaskFormService } from '../../services/task-form.service'; import { ProcessDefinitionService } from '../../services/process-definition.service'; @@ -50,7 +42,7 @@ describe('DropdownWidgetComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule, DropdownWidgetComponent] + imports: [DropdownWidgetComponent] }); fixture = TestBed.createComponent(DropdownWidgetComponent); widget = fixture.componentInstance; diff --git a/lib/process-services/src/lib/form/widgets/dynamic-table/dynamic-table.widget.spec.ts b/lib/process-services/src/lib/form/widgets/dynamic-table/dynamic-table.widget.spec.ts index a0b8986463..b0c5d3afe3 100644 --- a/lib/process-services/src/lib/form/widgets/dynamic-table/dynamic-table.widget.spec.ts +++ b/lib/process-services/src/lib/form/widgets/dynamic-table/dynamic-table.widget.spec.ts @@ -16,7 +16,7 @@ */ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { FormFieldModel, FormFieldTypes, FormModel, FormService, CoreTestingModule } from '@alfresco/adf-core'; +import { FormFieldModel, FormFieldTypes, FormModel, FormService } from '@alfresco/adf-core'; import { DynamicTableColumn } from './editors/models/dynamic-table-column.model'; import { DynamicTableRow } from './editors/models/dynamic-table-row.model'; import { DynamicTableWidgetComponent } from './dynamic-table.widget'; @@ -72,7 +72,7 @@ describe('DynamicTableWidgetComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule] + imports: [DynamicTableWidgetComponent] }); const field = new FormFieldModel(new FormModel()); formService = TestBed.inject(FormService); diff --git a/lib/process-services/src/lib/form/widgets/dynamic-table/editors/date/date.editor.spec.ts b/lib/process-services/src/lib/form/widgets/dynamic-table/editors/date/date.editor.spec.ts index 7158d8360f..185278b5ae 100644 --- a/lib/process-services/src/lib/form/widgets/dynamic-table/editors/date/date.editor.spec.ts +++ b/lib/process-services/src/lib/form/widgets/dynamic-table/editors/date/date.editor.spec.ts @@ -16,7 +16,7 @@ */ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { FormFieldModel, FormModel, CoreTestingModule } from '@alfresco/adf-core'; +import { FormFieldModel, FormModel } from '@alfresco/adf-core'; import { DynamicTableColumn } from '../models/dynamic-table-column.model'; import { DynamicTableRow } from '../models/dynamic-table-row.model'; import { DynamicTableModel } from '../models/dynamic-table.widget.model'; @@ -32,7 +32,7 @@ describe('DateEditorComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule] + imports: [DateEditorComponent] }); fixture = TestBed.createComponent(DateEditorComponent); component = fixture.componentInstance; diff --git a/lib/process-services/src/lib/form/widgets/dynamic-table/editors/datetime/datetime.editor.spec.ts b/lib/process-services/src/lib/form/widgets/dynamic-table/editors/datetime/datetime.editor.spec.ts index 04ff7f5110..6fb7261bf2 100644 --- a/lib/process-services/src/lib/form/widgets/dynamic-table/editors/datetime/datetime.editor.spec.ts +++ b/lib/process-services/src/lib/form/widgets/dynamic-table/editors/datetime/datetime.editor.spec.ts @@ -16,7 +16,7 @@ */ import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { FormFieldModel, FormModel, CoreTestingModule } from '@alfresco/adf-core'; +import { FormFieldModel, FormModel } from '@alfresco/adf-core'; import { DynamicTableColumn } from '../models/dynamic-table-column.model'; import { DynamicTableRow } from '../models/dynamic-table-row.model'; import { DynamicTableModel } from '../models/dynamic-table.widget.model'; @@ -31,7 +31,7 @@ describe('DateTimeEditorComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule] + imports: [DateTimeEditorComponent] }); fixture = TestBed.createComponent(DateTimeEditorComponent); component = fixture.componentInstance; diff --git a/lib/process-services/src/lib/form/widgets/dynamic-table/editors/datetime/datetime.editor.ts b/lib/process-services/src/lib/form/widgets/dynamic-table/editors/datetime/datetime.editor.ts index 40abdff3d9..18ccfa4b40 100644 --- a/lib/process-services/src/lib/form/widgets/dynamic-table/editors/datetime/datetime.editor.ts +++ b/lib/process-services/src/lib/form/widgets/dynamic-table/editors/datetime/datetime.editor.ts @@ -15,13 +15,7 @@ * limitations under the License. */ -import { - ADF_DATETIME_FORMATS, - ADF_DATE_FORMATS, - AdfDateFnsAdapter, - AdfDateTimeFnsAdapter /*MOMENT_DATE_FORMATS, MomentDateAdapter*/, - DateFnsUtils -} from '@alfresco/adf-core'; +import { ADF_DATETIME_FORMATS, ADF_DATE_FORMATS, AdfDateFnsAdapter, AdfDateTimeFnsAdapter, DateFnsUtils } from '@alfresco/adf-core'; import { Component, Input, OnInit } from '@angular/core'; import { DateAdapter, MAT_DATE_FORMATS } from '@angular/material/core'; import { DynamicTableColumn } from '../models/dynamic-table-column.model'; diff --git a/lib/process-services/src/lib/form/widgets/dynamic-table/editors/dropdown/dropdown.editor.spec.ts b/lib/process-services/src/lib/form/widgets/dynamic-table/editors/dropdown/dropdown.editor.spec.ts index a55d26b867..42617b2664 100644 --- a/lib/process-services/src/lib/form/widgets/dynamic-table/editors/dropdown/dropdown.editor.spec.ts +++ b/lib/process-services/src/lib/form/widgets/dynamic-table/editors/dropdown/dropdown.editor.spec.ts @@ -28,7 +28,6 @@ import { ProcessDefinitionService } from '../../../../services/process-definitio import { MatSelectHarness } from '@angular/material/select/testing'; import { HarnessLoader } from '@angular/cdk/testing'; import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed'; -import { ProcessTestingModule } from '../../../../../testing/process.testing.module'; describe('DropdownEditorComponent', () => { let fixture: ComponentFixture; @@ -44,7 +43,7 @@ describe('DropdownEditorComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessTestingModule, DropdownEditorComponent] + imports: [DropdownEditorComponent] }); formService = TestBed.inject(FormService); taskFormService = TestBed.inject(TaskFormService); diff --git a/lib/process-services/src/lib/form/widgets/dynamic-table/editors/row-editor/row.editor.spec.ts b/lib/process-services/src/lib/form/widgets/dynamic-table/editors/row-editor/row.editor.spec.ts index cabf5c163b..0ecbfa635d 100644 --- a/lib/process-services/src/lib/form/widgets/dynamic-table/editors/row-editor/row.editor.spec.ts +++ b/lib/process-services/src/lib/form/widgets/dynamic-table/editors/row-editor/row.editor.spec.ts @@ -15,21 +15,17 @@ * limitations under the License. */ -import { FormFieldModel, FormModel, FormService, CoreTestingModule } from '@alfresco/adf-core'; +import { FormFieldModel, FormModel, FormService } from '@alfresco/adf-core'; import { DynamicTableColumn } from '../models/dynamic-table-column.model'; import { DynamicTableRow } from '../models/dynamic-table-row.model'; import { DynamicTableModel } from '../models/dynamic-table.widget.model'; import { RowEditorComponent } from './row.editor'; import { DynamicRowValidationSummary } from '../models/dynamic-row-validation-summary.model'; -import { TestBed } from '@angular/core/testing'; describe('RowEditorComponent', () => { let component: RowEditorComponent; beforeEach(() => { - TestBed.configureTestingModule({ - imports: [CoreTestingModule] - }); component = new RowEditorComponent(); const field = new FormFieldModel(new FormModel()); component.table = new DynamicTableModel(field, new FormService()); diff --git a/lib/process-services/src/lib/form/widgets/functional-group/functional-group.widget.spec.ts b/lib/process-services/src/lib/form/widgets/functional-group/functional-group.widget.spec.ts index 6e79ba7cdb..8f80e88ab0 100644 --- a/lib/process-services/src/lib/form/widgets/functional-group/functional-group.widget.spec.ts +++ b/lib/process-services/src/lib/form/widgets/functional-group/functional-group.widget.spec.ts @@ -16,7 +16,7 @@ */ import { of, timer } from 'rxjs'; -import { FormFieldModel, FormModel, GroupModel, CoreTestingModule, FormFieldTypes, UnitTestingUtils } from '@alfresco/adf-core'; +import { FormFieldModel, FormModel, GroupModel, FormFieldTypes, UnitTestingUtils } from '@alfresco/adf-core'; import { FunctionalGroupWidgetComponent } from './functional-group.widget'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { PeopleProcessService } from '../../../services/people-process.service'; @@ -41,7 +41,7 @@ describe('FunctionalGroupWidgetComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule] + imports: [FunctionalGroupWidgetComponent] }); peopleProcessService = TestBed.inject(PeopleProcessService); getWorkflowGroupsSpy = spyOn(peopleProcessService, 'getWorkflowGroups').and.returnValue(of([])); diff --git a/lib/process-services/src/lib/form/widgets/people/people.widget.spec.ts b/lib/process-services/src/lib/form/widgets/people/people.widget.spec.ts index 7aa561df51..486b9ab076 100644 --- a/lib/process-services/src/lib/form/widgets/people/people.widget.spec.ts +++ b/lib/process-services/src/lib/form/widgets/people/people.widget.spec.ts @@ -17,7 +17,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; -import { FormFieldTypes, FormFieldModel, FormModel, CoreTestingModule } from '@alfresco/adf-core'; +import { FormFieldTypes, FormFieldModel, FormModel } from '@alfresco/adf-core'; import { Observable, of } from 'rxjs'; import { PeopleWidgetComponent } from './people.widget'; import { TranslateService } from '@ngx-translate/core'; @@ -40,7 +40,7 @@ describe('PeopleWidgetComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule] + imports: [PeopleWidgetComponent] }); fixture = TestBed.createComponent(PeopleWidgetComponent); peopleProcessService = TestBed.inject(PeopleProcessService); diff --git a/lib/process-services/src/lib/form/widgets/typeahead/typeahead.widget.spec.ts b/lib/process-services/src/lib/form/widgets/typeahead/typeahead.widget.spec.ts index c7d5e03334..2c9e3807b8 100644 --- a/lib/process-services/src/lib/form/widgets/typeahead/typeahead.widget.spec.ts +++ b/lib/process-services/src/lib/form/widgets/typeahead/typeahead.widget.spec.ts @@ -17,9 +17,8 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { Observable, of } from 'rxjs'; - import { By } from '@angular/platform-browser'; -import { FormService, FormFieldOption, FormFieldTypes, FormFieldModel, FormModel, CoreTestingModule } from '@alfresco/adf-core'; +import { FormService, FormFieldOption, FormFieldTypes, FormFieldModel, FormModel } from '@alfresco/adf-core'; import { TypeaheadWidgetComponent } from './typeahead.widget'; import { TranslateService } from '@ngx-translate/core'; import { TaskFormService } from '../../services/task-form.service'; @@ -34,7 +33,7 @@ describe('TypeaheadWidgetComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule, TypeaheadWidgetComponent] + imports: [TypeaheadWidgetComponent] }); translationService = TestBed.inject(TranslateService); taskFormService = TestBed.inject(TaskFormService); diff --git a/lib/process-services/src/lib/form/widgets/upload/upload.widget.spec.ts b/lib/process-services/src/lib/form/widgets/upload/upload.widget.spec.ts index 89a8488f3f..d8f322b151 100644 --- a/lib/process-services/src/lib/form/widgets/upload/upload.widget.spec.ts +++ b/lib/process-services/src/lib/form/widgets/upload/upload.widget.spec.ts @@ -19,7 +19,7 @@ import { DebugElement } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; import { of } from 'rxjs'; -import { FormService, FormFieldTypes, FormModel, FormFieldModel, CoreTestingModule } from '@alfresco/adf-core'; +import { FormService, FormFieldTypes, FormModel, FormFieldModel } from '@alfresco/adf-core'; import { UploadWidgetComponent } from './upload.widget'; import { RelatedContentRepresentation } from '@alfresco/js-api'; import { ProcessContentService } from '../../services/process-content.service'; @@ -74,7 +74,7 @@ describe('UploadWidgetComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule, UploadWidgetComponent] + imports: [UploadWidgetComponent] }); }); diff --git a/lib/process-services/src/lib/people/components/people-list/people-list.component.spec.ts b/lib/process-services/src/lib/people/components/people-list/people-list.component.spec.ts index 9a8bc4e7fa..fc759acfd3 100644 --- a/lib/process-services/src/lib/people/components/people-list/people-list.component.spec.ts +++ b/lib/process-services/src/lib/people/components/people-list/people-list.component.spec.ts @@ -19,7 +19,6 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { DataRowActionEvent, DataRowEvent, ObjectDataRow } from '@alfresco/adf-core'; import { UserEventModel } from '../../../task-list/models/user-event.model'; import { PeopleListComponent } from './people-list.component'; -import { ProcessTestingModule } from '../../../testing/process.testing.module'; import { LightUserRepresentation } from '@alfresco/js-api'; const fakeUser: LightUserRepresentation = { @@ -35,7 +34,7 @@ describe('PeopleListComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessTestingModule, PeopleListComponent] + imports: [PeopleListComponent] }); fixture = TestBed.createComponent(PeopleListComponent); peopleListComponent = fixture.componentInstance; diff --git a/lib/process-services/src/lib/people/components/people-search-field/people-search-field.component.spec.ts b/lib/process-services/src/lib/people/components/people-search-field/people-search-field.component.spec.ts index ef3decda44..51d2bbd6fc 100644 --- a/lib/process-services/src/lib/people/components/people-search-field/people-search-field.component.spec.ts +++ b/lib/process-services/src/lib/people/components/people-search-field/people-search-field.component.spec.ts @@ -19,7 +19,6 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { DebugElement } from '@angular/core'; import { PeopleSearchFieldComponent } from './people-search-field.component'; import { By } from '@angular/platform-browser'; -import { ProcessTestingModule } from '../../../testing/process.testing.module'; describe('PeopleSearchFieldComponent', () => { let component: PeopleSearchFieldComponent; @@ -28,9 +27,6 @@ describe('PeopleSearchFieldComponent', () => { let element: HTMLElement; beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ProcessTestingModule] - }); fixture = TestBed.createComponent(PeopleSearchFieldComponent); component = fixture.componentInstance; debug = fixture.debugElement; diff --git a/lib/process-services/src/lib/people/components/people-search/people-search.component.spec.ts b/lib/process-services/src/lib/people/components/people-search/people-search.component.spec.ts index 55816269b5..d2d276e650 100644 --- a/lib/process-services/src/lib/people/components/people-search/people-search.component.spec.ts +++ b/lib/process-services/src/lib/people/components/people-search/people-search.component.spec.ts @@ -18,7 +18,6 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { of } from 'rxjs'; import { PeopleSearchComponent } from './people-search.component'; -import { ProcessTestingModule } from '../../../testing/process.testing.module'; import { LightUserRepresentation } from '@alfresco/js-api'; const fakeUser: LightUserRepresentation = { @@ -44,7 +43,7 @@ describe('PeopleSearchComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessTestingModule, PeopleSearchComponent] + imports: [PeopleSearchComponent] }); fixture = TestBed.createComponent(PeopleSearchComponent); peopleSearchComponent = fixture.componentInstance; diff --git a/lib/process-services/src/lib/people/components/people-selector/people-selector.component.spec.ts b/lib/process-services/src/lib/people/components/people-selector/people-selector.component.spec.ts index 3903685519..3b6c4f3455 100644 --- a/lib/process-services/src/lib/people/components/people-selector/people-selector.component.spec.ts +++ b/lib/process-services/src/lib/people/components/people-selector/people-selector.component.spec.ts @@ -19,7 +19,6 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { PeopleSelectorComponent } from './people-selector.component'; import { of } from 'rxjs'; import { By } from '@angular/platform-browser'; -import { ProcessTestingModule } from '../../../testing/process.testing.module'; import { PeopleProcessService } from '../../../services/people-process.service'; describe('PeopleSelectorComponent', () => { @@ -27,9 +26,6 @@ describe('PeopleSelectorComponent', () => { let fixture: ComponentFixture; beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ProcessTestingModule] - }); fixture = TestBed.createComponent(PeopleSelectorComponent); component = fixture.componentInstance; fixture.detectChanges(); diff --git a/lib/process-services/src/lib/people/components/people/people.component.spec.ts b/lib/process-services/src/lib/people/components/people/people.component.spec.ts index 4082185c7e..5970cb2d75 100644 --- a/lib/process-services/src/lib/people/components/people/people.component.spec.ts +++ b/lib/process-services/src/lib/people/components/people/people.component.spec.ts @@ -17,10 +17,9 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { PeopleComponent } from './people.component'; -import { ProcessTestingModule } from '../../../testing/process.testing.module'; import { LightUserRepresentation } from '@alfresco/js-api'; -import { PeopleProcessService } from '@alfresco/adf-process-services'; import { of, throwError } from 'rxjs'; +import { PeopleProcessService } from '../../../services/people-process.service'; const fakeUser: LightUserRepresentation = { id: 0, @@ -45,7 +44,7 @@ describe('PeopleComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessTestingModule, PeopleComponent] + imports: [PeopleComponent] }); fixture = TestBed.createComponent(PeopleComponent); peopleProcessService = fixture.debugElement.injector.get(PeopleProcessService); diff --git a/lib/process-services/src/lib/process-list/components/process-audit/process-audit.directive.spec.ts b/lib/process-services/src/lib/process-list/components/process-audit/process-audit.directive.spec.ts index 024c677741..1a481078de 100644 --- a/lib/process-services/src/lib/process-list/components/process-audit/process-audit.directive.spec.ts +++ b/lib/process-services/src/lib/process-list/components/process-audit/process-audit.directive.spec.ts @@ -20,9 +20,8 @@ import { ComponentFixture, fakeAsync, TestBed } from '@angular/core/testing'; import { of, throwError } from 'rxjs'; import { ProcessService } from '../../services/process.service'; import { DownloadService } from '@alfresco/adf-core'; -import { ProcessTestingModule } from '../../../testing/process.testing.module'; import { ProcessInstanceAuditInfoRepresentation } from '@alfresco/js-api'; -import { ProcessAuditDirective } from '@alfresco/adf-process-services'; +import { ProcessAuditDirective } from './process-audit.directive'; @Component({ selector: 'adf-basic-button', @@ -81,7 +80,7 @@ describe('ProcessAuditDirective', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessTestingModule, BasicButtonComponent] + imports: [BasicButtonComponent] }); fixture = TestBed.createComponent(BasicButtonComponent); component = fixture.componentInstance; diff --git a/lib/process-services/src/lib/process-list/components/process-filters/process-filters.component.spec.ts b/lib/process-services/src/lib/process-list/components/process-filters/process-filters.component.spec.ts index 06511fb102..80106c4979 100644 --- a/lib/process-services/src/lib/process-list/components/process-filters/process-filters.component.spec.ts +++ b/lib/process-services/src/lib/process-list/components/process-filters/process-filters.component.spec.ts @@ -22,9 +22,9 @@ import { ProcessFilterService } from '../../services/process-filter.service'; import { ProcessFiltersComponent } from './process-filters.component'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; -import { ProcessTestingModule } from '../../../testing/process.testing.module'; import { NavigationStart, Router } from '@angular/router'; import { ProcessInstanceFilterRepresentation, UserProcessInstanceFilterRepresentation } from '@alfresco/js-api'; +import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services'; const fakeProcessFilters: UserProcessInstanceFilterRepresentation[] = [ { @@ -58,7 +58,8 @@ describe('ProcessFiltersComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessTestingModule] + imports: [], + providers: [{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }] }); processFilterService = TestBed.inject(ProcessFilterService); diff --git a/lib/process-services/src/lib/process-list/components/process-instance-details/process-instance-details.component.spec.ts b/lib/process-services/src/lib/process-list/components/process-instance-details/process-instance-details.component.spec.ts index a79a342f33..3dca6d3212 100644 --- a/lib/process-services/src/lib/process-list/components/process-instance-details/process-instance-details.component.spec.ts +++ b/lib/process-services/src/lib/process-list/components/process-instance-details/process-instance-details.component.spec.ts @@ -24,10 +24,10 @@ import { exampleProcess, exampleProcessNoName, mockRunningProcess, processEnded import { mockProcessInstanceComments } from '../../../testing/mock/process/process-comments.mock'; import { ProcessService } from '../../services/process.service'; import { ProcessInstanceDetailsComponent } from './process-instance-details.component'; -import { ProcessTestingModule } from '../../../testing/process.testing.module'; import { HarnessLoader } from '@angular/cdk/testing'; import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed'; import { MatCardHarness } from '@angular/material/card/testing'; +import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services'; describe('ProcessInstanceDetailsComponent', () => { let service: ProcessService; @@ -38,7 +38,8 @@ describe('ProcessInstanceDetailsComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessTestingModule, ProcessInstanceDetailsComponent], + imports: [ProcessInstanceDetailsComponent], + providers: [{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }], schemas: [NO_ERRORS_SCHEMA] }); fixture = TestBed.createComponent(ProcessInstanceDetailsComponent); diff --git a/lib/process-services/src/lib/process-list/components/process-instance-header/process-instance-header.component.spec.ts b/lib/process-services/src/lib/process-list/components/process-instance-header/process-instance-header.component.spec.ts index 4e40477e46..ac64775349 100644 --- a/lib/process-services/src/lib/process-list/components/process-instance-header/process-instance-header.component.spec.ts +++ b/lib/process-services/src/lib/process-list/components/process-instance-header/process-instance-header.component.spec.ts @@ -19,7 +19,6 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { AppConfigService } from '@alfresco/adf-core'; import { exampleProcess } from '../../../testing/mock'; import { ProcessInstanceHeaderComponent } from './process-instance-header.component'; -import { ProcessTestingModule } from '../../../testing/process.testing.module'; describe('ProcessInstanceHeaderComponent', () => { let component: ProcessInstanceHeaderComponent; @@ -27,9 +26,6 @@ describe('ProcessInstanceHeaderComponent', () => { let appConfigService: AppConfigService; beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ProcessTestingModule] - }); fixture = TestBed.createComponent(ProcessInstanceHeaderComponent); component = fixture.componentInstance; diff --git a/lib/process-services/src/lib/process-list/components/process-instance-tasks/process-instance-tasks.component.spec.ts b/lib/process-services/src/lib/process-list/components/process-instance-tasks/process-instance-tasks.component.spec.ts index 83102ed379..728442d927 100644 --- a/lib/process-services/src/lib/process-list/components/process-instance-tasks/process-instance-tasks.component.spec.ts +++ b/lib/process-services/src/lib/process-list/components/process-instance-tasks/process-instance-tasks.component.spec.ts @@ -22,7 +22,6 @@ import { of } from 'rxjs'; import { taskDetailsMock } from '../../../testing/mock'; import { ProcessService } from '../../services/process.service'; import { ProcessInstanceTasksComponent } from './process-instance-tasks.component'; -import { ProcessTestingModule } from '../../../testing/process.testing.module'; import { HarnessLoader } from '@angular/cdk/testing'; import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed'; import { MatListItemHarness } from '@angular/material/list/testing'; @@ -37,9 +36,6 @@ describe('ProcessInstanceTasksComponent', () => { const exampleProcessInstance: ProcessInstanceRepresentation = { id: '123' }; beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ProcessTestingModule] - }); fixture = TestBed.createComponent(ProcessInstanceTasksComponent); processService = TestBed.inject(ProcessService); component = fixture.componentInstance; diff --git a/lib/process-services/src/lib/process-list/components/process-list/process-list.component.spec.ts b/lib/process-services/src/lib/process-list/components/process-list/process-list.component.spec.ts index 966f17d9bc..3bd035e188 100644 --- a/lib/process-services/src/lib/process-list/components/process-list/process-list.component.spec.ts +++ b/lib/process-services/src/lib/process-list/components/process-list/process-list.component.spec.ts @@ -36,7 +36,6 @@ import { } from '@alfresco/adf-core'; import { fakeProcessInstance, fakeProcessInstancesWithNoName, fakeProcessInstancesEmpty, fakeProcessColumnSchema } from '../../../testing/mock'; import { ProcessService } from '../../services/process.service'; -import { ProcessTestingModule } from '../../../testing/process.testing.module'; import { HarnessLoader } from '@angular/cdk/testing'; import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed'; import { MatProgressSpinnerHarness } from '@angular/material/progress-spinner/testing'; @@ -59,9 +58,6 @@ describe('ProcessInstanceListComponent', () => { }; beforeEach(() => { - TestBed.configureTestingModule({ - imports: [ProcessTestingModule] - }); fixture = TestBed.createComponent(ProcessInstanceListComponent); component = fixture.componentInstance; loader = TestbedHarnessEnvironment.loader(fixture); @@ -489,7 +485,7 @@ describe('CustomProcessListComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessTestingModule, CustomProcessListComponent] + imports: [CustomProcessListComponent] }); fixture = TestBed.createComponent(CustomProcessListComponent); fixture.detectChanges(); @@ -524,7 +520,7 @@ describe('Process List: Custom EmptyTemplateComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessTestingModule, EmptyTemplateComponent] + imports: [EmptyTemplateComponent] }); fixture = TestBed.createComponent(EmptyTemplateComponent); processService = TestBed.inject(ProcessService); @@ -620,7 +616,7 @@ describe('ProcessListContextMenuComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessTestingModule, ProcessListContextMenuComponent] + imports: [ProcessListContextMenuComponent] }); fixture = TestBed.createComponent(ProcessListContextMenuComponent); customComponent = fixture.componentInstance; diff --git a/lib/process-services/src/lib/process-list/services/process-filter.service.spec.ts b/lib/process-services/src/lib/process-list/services/process-filter.service.spec.ts index ffa61e4782..383c6abb47 100644 --- a/lib/process-services/src/lib/process-list/services/process-filter.service.spec.ts +++ b/lib/process-services/src/lib/process-list/services/process-filter.service.spec.ts @@ -17,7 +17,6 @@ import { TestBed } from '@angular/core/testing'; import { ProcessFilterService } from './process-filter.service'; -import { CoreTestingModule } from '@alfresco/adf-core'; import { ProcessInstanceFilterRepresentation, UserProcessInstanceFilterRepresentation } from '@alfresco/js-api'; import { of } from 'rxjs'; import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services'; @@ -50,7 +49,6 @@ describe('Process filter', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule], providers: [{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }] }); service = TestBed.inject(ProcessFilterService); diff --git a/lib/process-services/src/lib/process-list/services/process.service.spec.ts b/lib/process-services/src/lib/process-list/services/process.service.spec.ts index 0321f73fd3..a15b6029c4 100644 --- a/lib/process-services/src/lib/process-list/services/process.service.spec.ts +++ b/lib/process-services/src/lib/process-list/services/process.service.spec.ts @@ -18,8 +18,7 @@ import { TestBed } from '@angular/core/testing'; import { exampleProcess } from '../../testing/mock'; import { ProcessService } from './process.service'; -import { CoreModule, DateFnsUtils } from '@alfresco/adf-core'; -import { ProcessTestingModule } from '../../testing/process.testing.module'; +import { DateFnsUtils } from '@alfresco/adf-core'; import { ProcessInstanceQueryRepresentation, ProcessDefinitionRepresentation, RestVariable, TaskRepresentation } from '@alfresco/js-api'; const fakeTasksList = { @@ -55,7 +54,7 @@ describe('ProcessService', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreModule.forRoot(), ProcessTestingModule] + imports: [] }); service = TestBed.inject(ProcessService); }); diff --git a/lib/process-services/src/lib/services/people-process.service.spec.ts b/lib/process-services/src/lib/services/people-process.service.spec.ts index c1d50bac30..f3527d7dc7 100644 --- a/lib/process-services/src/lib/services/people-process.service.spec.ts +++ b/lib/process-services/src/lib/services/people-process.service.spec.ts @@ -17,7 +17,6 @@ import { fakeAsync, TestBed } from '@angular/core/testing'; import { PeopleProcessService } from './people-process.service'; -import { CoreTestingModule } from '@alfresco/adf-core'; import { LightUserRepresentation } from '@alfresco/js-api'; import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services'; @@ -46,7 +45,6 @@ describe('PeopleProcessService', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule], providers: [{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }] }); service = TestBed.inject(PeopleProcessService); diff --git a/lib/process-services/src/lib/task-list/components/attach-form/attach-form.component.spec.ts b/lib/process-services/src/lib/task-list/components/attach-form/attach-form.component.spec.ts index 52072bf074..24c3cd093c 100644 --- a/lib/process-services/src/lib/task-list/components/attach-form/attach-form.component.spec.ts +++ b/lib/process-services/src/lib/task-list/components/attach-form/attach-form.component.spec.ts @@ -17,10 +17,10 @@ import { AttachFormComponent } from './attach-form.component'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { ProcessTestingModule } from '../../../testing/process.testing.module'; import { TaskListService } from '../../services/tasklist.service'; import { of } from 'rxjs'; import { By } from '@angular/platform-browser'; +import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services'; describe('AttachFormComponent', () => { let component: AttachFormComponent; @@ -30,7 +30,8 @@ describe('AttachFormComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessTestingModule, AttachFormComponent] + imports: [AttachFormComponent], + providers: [{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }] }); fixture = TestBed.createComponent(AttachFormComponent); component = fixture.componentInstance; diff --git a/lib/process-services/src/lib/task-list/components/checklist/checklist.component.spec.ts b/lib/process-services/src/lib/task-list/components/checklist/checklist.component.spec.ts index 1b2e32347a..63874e8a06 100644 --- a/lib/process-services/src/lib/task-list/components/checklist/checklist.component.spec.ts +++ b/lib/process-services/src/lib/task-list/components/checklist/checklist.component.spec.ts @@ -18,7 +18,6 @@ import { SimpleChange } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { ChecklistComponent } from './checklist.component'; -import { ProcessTestingModule } from '../../../testing/process.testing.module'; import { TaskListService } from '../../services/tasklist.service'; import { of } from 'rxjs'; import { TaskRepresentation } from '@alfresco/js-api'; @@ -32,7 +31,7 @@ describe('ChecklistComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessTestingModule] + imports: [ChecklistComponent] }); service = TestBed.inject(TaskListService); spyOn(service, 'getTaskChecklist').and.returnValue( diff --git a/lib/process-services/src/lib/task-list/components/start-task/start-task.component.spec.ts b/lib/process-services/src/lib/task-list/components/start-task/start-task.component.spec.ts index 6cb2714481..46cfdbae14 100644 --- a/lib/process-services/src/lib/task-list/components/start-task/start-task.component.spec.ts +++ b/lib/process-services/src/lib/task-list/components/start-task/start-task.component.spec.ts @@ -19,7 +19,6 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { of, throwError } from 'rxjs'; import { TaskListService } from '../../services/tasklist.service'; import { StartTaskComponent } from './start-task.component'; -import { ProcessTestingModule } from '../../../testing/process.testing.module'; import { taskDetailsMock } from '../../../testing/mock/task/task-details.mock'; import { HarnessLoader } from '@angular/cdk/testing'; import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed'; @@ -50,7 +49,7 @@ describe('StartTaskComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessTestingModule, StartTaskComponent] + imports: [StartTaskComponent] }); fixture = TestBed.createComponent(StartTaskComponent); component = fixture.componentInstance; @@ -66,7 +65,6 @@ describe('StartTaskComponent', () => { afterEach(() => { fixture.destroy(); - TestBed.resetTestingModule(); }); it('should fetch fake form on init', () => { diff --git a/lib/process-services/src/lib/task-list/components/task-details/task-details.component.spec.ts b/lib/process-services/src/lib/task-list/components/task-details/task-details.component.spec.ts index 5d4395574b..0068d0d39a 100644 --- a/lib/process-services/src/lib/task-list/components/task-details/task-details.component.spec.ts +++ b/lib/process-services/src/lib/task-list/components/task-details/task-details.component.spec.ts @@ -23,7 +23,6 @@ import { FormModel, FormOutcomeEvent, FormOutcomeModel, CommentModel, User, ADF_ import { noDataMock, taskDetailsMock, taskFormMock, tasksMock, taskDetailsWithOutAssigneeMock } from '../../../testing/mock'; import { TaskListService } from '../../services/tasklist.service'; import { TaskDetailsComponent } from './task-details.component'; -import { ProcessTestingModule } from '../../../testing/process.testing.module'; import { TaskService } from '../../../form/services/task.service'; import { TaskFormService } from '../../../form/services/task-form.service'; import { PeopleProcessService } from '../../../services/people-process.service'; @@ -31,6 +30,7 @@ import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed'; import { HarnessLoader } from '@angular/cdk/testing'; import { MatDialogHarness } from '@angular/material/dialog/testing'; import { LightUserRepresentation, TaskRepresentation } from '@alfresco/js-api'; +import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services'; const fakeUser: LightUserRepresentation = { id: 0, @@ -60,7 +60,8 @@ describe('TaskDetailsComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessTestingModule, TaskDetailsComponent] + imports: [TaskDetailsComponent], + providers: [{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }] }); peopleProcessService = TestBed.inject(PeopleProcessService); spyOn(peopleProcessService, 'getCurrentUserInfo').and.returnValue(of({ email: 'fake-email' } as any)); diff --git a/lib/process-services/src/lib/task-list/components/task-filters/task-filters.component.spec.ts b/lib/process-services/src/lib/task-list/components/task-filters/task-filters.component.spec.ts index d98809e692..3e63d9727e 100644 --- a/lib/process-services/src/lib/task-list/components/task-filters/task-filters.component.spec.ts +++ b/lib/process-services/src/lib/task-list/components/task-filters/task-filters.component.spec.ts @@ -23,10 +23,8 @@ import { of, throwError } from 'rxjs'; import { TaskListService } from '../../services/tasklist.service'; import { TaskFilterService } from '../../services/task-filter.service'; import { TaskFiltersComponent } from './task-filters.component'; -import { ProcessTestingModule } from '../../../testing/process.testing.module'; import { By } from '@angular/platform-browser'; -import { NavigationStart, Router } from '@angular/router'; -import { RouterTestingModule } from '@angular/router/testing'; +import { NavigationStart, provideRouter, Router } from '@angular/router'; import { UserTaskFilterRepresentation } from '@alfresco/js-api'; const fakeTaskFilters = [ @@ -60,7 +58,8 @@ describe('TaskFiltersComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessTestingModule, RouterTestingModule, TaskFiltersComponent] + imports: [TaskFiltersComponent], + providers: [provideRouter([])] }); const appConfig: AppConfigService = TestBed.inject(AppConfigService); appConfig.config.bpmHost = 'http://localhost:9876/bpm'; diff --git a/lib/process-services/src/lib/task-list/components/task-form/claim-task.directive.spec.ts b/lib/process-services/src/lib/task-list/components/task-form/claim-task.directive.spec.ts index 3b19b981e1..b65646f42d 100644 --- a/lib/process-services/src/lib/task-list/components/task-form/claim-task.directive.spec.ts +++ b/lib/process-services/src/lib/task-list/components/task-form/claim-task.directive.spec.ts @@ -19,8 +19,7 @@ import { Component, Output, EventEmitter } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { of } from 'rxjs'; import { TaskListService } from '../../services/tasklist.service'; -import { ProcessTestingModule } from '../../../testing/process.testing.module'; -import { ClaimTaskDirective } from '@alfresco/adf-process-services'; +import { ClaimTaskDirective } from './claim-task.directive'; describe('ClaimTaskDirective', () => { @Component({ @@ -44,7 +43,7 @@ describe('ClaimTaskDirective', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessTestingModule, TestComponent] + imports: [TestComponent] }); taskListService = TestBed.inject(TaskListService); fixture = TestBed.createComponent(TestComponent); @@ -92,7 +91,7 @@ describe('Claim Task Directive validation errors', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessTestingModule, ClaimTestMissingTaskIdDirectiveComponent, ClaimTestMissingInputDirectiveComponent] + imports: [ClaimTestMissingTaskIdDirectiveComponent, ClaimTestMissingInputDirectiveComponent] }); fixture = TestBed.createComponent(ClaimTestMissingInputDirectiveComponent); }); diff --git a/lib/process-services/src/lib/task-list/components/task-form/task-form.component.spec.ts b/lib/process-services/src/lib/task-list/components/task-form/task-form.component.spec.ts index 897b17ecf4..d5794b5865 100644 --- a/lib/process-services/src/lib/task-list/components/task-form/task-form.component.spec.ts +++ b/lib/process-services/src/lib/task-list/components/task-form/task-form.component.spec.ts @@ -41,7 +41,6 @@ import { taskDetailsWithOutFormMock, taskFormMock } from '../../../testing/mock/task/task-details.mock'; -import { ProcessTestingModule } from '../../../testing/process.testing.module'; import { By } from '@angular/platform-browser'; import { TaskFormService } from '../../../form/services/task-form.service'; import { TaskService } from '../../../form/services/task.service'; @@ -62,7 +61,6 @@ describe('TaskFormComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessTestingModule], schemas: [NO_ERRORS_SCHEMA] }); fixture = TestBed.createComponent(TaskFormComponent); diff --git a/lib/process-services/src/lib/task-list/components/task-form/unclaim-task.directive.spec.ts b/lib/process-services/src/lib/task-list/components/task-form/unclaim-task.directive.spec.ts index 8acfb894f5..825cdc631e 100644 --- a/lib/process-services/src/lib/task-list/components/task-form/unclaim-task.directive.spec.ts +++ b/lib/process-services/src/lib/task-list/components/task-form/unclaim-task.directive.spec.ts @@ -19,8 +19,8 @@ import { Component, Output, EventEmitter } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { of } from 'rxjs'; import { TaskListService } from '../../services/tasklist.service'; -import { ProcessTestingModule } from '../../../testing/process.testing.module'; -import { UnclaimTaskDirective } from '@alfresco/adf-process-services'; +import { UnclaimTaskDirective } from './unclaim-task.directive'; +import { NoopAuthModule, NoopTranslateModule } from '@alfresco/adf-core'; describe('UnclaimTaskDirective', () => { @Component({ @@ -44,7 +44,7 @@ describe('UnclaimTaskDirective', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessTestingModule, TestComponent] + imports: [NoopTranslateModule, NoopAuthModule, TestComponent] }); taskListService = TestBed.inject(TaskListService); fixture = TestBed.createComponent(TestComponent); @@ -88,24 +88,19 @@ describe('Claim Task Directive validation errors', () => { }) class ClaimTestMissingTaskIdDirectiveComponent {} - let fixture: ComponentFixture; - beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessTestingModule, ClaimTestMissingTaskIdDirectiveComponent, ClaimTestMissingInputDirectiveComponent] + imports: [NoopTranslateModule, NoopAuthModule, ClaimTestMissingTaskIdDirectiveComponent, ClaimTestMissingInputDirectiveComponent] }); - fixture = TestBed.createComponent(ClaimTestMissingInputDirectiveComponent); }); it('should throw error when missing input', () => { - fixture = TestBed.createComponent(ClaimTestMissingInputDirectiveComponent); - + const fixture = TestBed.createComponent(ClaimTestMissingInputDirectiveComponent); expect(() => fixture.detectChanges()).toThrowError(); }); it('should throw error when taskId is not set', () => { - fixture = TestBed.createComponent(ClaimTestMissingTaskIdDirectiveComponent); - + const fixture = TestBed.createComponent(ClaimTestMissingTaskIdDirectiveComponent); expect(() => fixture.detectChanges()).toThrowError('Attribute taskId is required'); }); }); diff --git a/lib/process-services/src/lib/task-list/components/task-header/task-header.component.spec.ts b/lib/process-services/src/lib/task-list/components/task-header/task-header.component.spec.ts index 7f95e9d6b1..fd2e4c60b5 100644 --- a/lib/process-services/src/lib/task-list/components/task-header/task-header.component.spec.ts +++ b/lib/process-services/src/lib/task-list/components/task-header/task-header.component.spec.ts @@ -29,7 +29,6 @@ import { } from '../../../testing/mock'; import { TaskListService } from '../../services/tasklist.service'; import { TaskHeaderComponent } from './task-header.component'; -import { ProcessTestingModule } from '../../../testing/process.testing.module'; import { PeopleProcessService } from '../../../services/people-process.service'; import { TaskRepresentation } from '@alfresco/js-api'; import { SimpleChanges } from '@angular/core'; @@ -58,7 +57,7 @@ describe('TaskHeaderComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessTestingModule, TaskHeaderComponent] + imports: [TaskHeaderComponent] }); fixture = TestBed.createComponent(TaskHeaderComponent); component = fixture.componentInstance; diff --git a/lib/process-services/src/lib/task-list/components/task-list/task-list.component.spec.ts b/lib/process-services/src/lib/task-list/components/task-list/task-list.component.spec.ts index 4e28c16de5..8587b46bdb 100644 --- a/lib/process-services/src/lib/task-list/components/task-list/task-list.component.spec.ts +++ b/lib/process-services/src/lib/task-list/components/task-list/task-list.component.spec.ts @@ -32,7 +32,6 @@ import { } from '@alfresco/adf-core'; import { TaskListService } from '../../services/tasklist.service'; import { TaskListComponent } from './task-list.component'; -import { ProcessTestingModule } from '../../../testing/process.testing.module'; import { fakeGlobalTask, fakeEmptyTask, paginatedTask, fakeColumnSchema, fakeCustomSchema } from '../../../testing/mock'; import { TranslateService } from '@ngx-translate/core'; import { of, Subject } from 'rxjs'; @@ -669,7 +668,7 @@ describe('CustomTaskListComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessTestingModule, CustomTaskListComponent, CustomTaskListComponent] + imports: [CustomTaskListComponent, CustomTaskListComponent] }); fixture = TestBed.createComponent(CustomTaskListComponent); fixture.detectChanges(); @@ -709,7 +708,7 @@ describe('Task List: Custom EmptyTemplateComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessTestingModule, EmptyTemplateComponent] + imports: [EmptyTemplateComponent] }); translateService = TestBed.inject(TranslateService); taskListService = TestBed.inject(TaskListService); @@ -797,7 +796,7 @@ describe('TaskListContextMenuComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessTestingModule, TaskListContextMenuComponent] + imports: [TaskListContextMenuComponent] }); fixture = TestBed.createComponent(TaskListContextMenuComponent); customComponent = fixture.componentInstance; diff --git a/lib/process-services/src/lib/task-list/components/task-standalone/task-standalone.component.spec.ts b/lib/process-services/src/lib/task-list/components/task-standalone/task-standalone.component.spec.ts index 6fdb6f7962..9ee867abb3 100644 --- a/lib/process-services/src/lib/task-list/components/task-standalone/task-standalone.component.spec.ts +++ b/lib/process-services/src/lib/task-list/components/task-standalone/task-standalone.component.spec.ts @@ -17,7 +17,6 @@ import { TaskStandaloneComponent } from './task-standalone.component'; import { ComponentFixture, TestBed } from '@angular/core/testing'; -import { ProcessTestingModule } from '../../../testing/process.testing.module'; describe('TaskStandaloneComponent', () => { let component: TaskStandaloneComponent; @@ -26,7 +25,7 @@ describe('TaskStandaloneComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ProcessTestingModule, TaskStandaloneComponent] + imports: [TaskStandaloneComponent] }); fixture = TestBed.createComponent(TaskStandaloneComponent); component = fixture.componentInstance; diff --git a/lib/process-services/src/lib/task-list/services/task-filter.service.spec.ts b/lib/process-services/src/lib/task-list/services/task-filter.service.spec.ts index 6749ef1f65..2942ba7528 100644 --- a/lib/process-services/src/lib/task-list/services/task-filter.service.spec.ts +++ b/lib/process-services/src/lib/task-list/services/task-filter.service.spec.ts @@ -17,7 +17,6 @@ import { TestBed } from '@angular/core/testing'; import { TaskFilterService } from './task-filter.service'; -import { CoreTestingModule } from '@alfresco/adf-core'; import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services'; describe('TaskListService', () => { @@ -31,7 +30,6 @@ describe('TaskListService', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [CoreTestingModule], providers: [{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }] }); service = TestBed.inject(TaskFilterService);