mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
[ACS-5620] stabilise unit tests by switching to standard Angular api (#8759)
* switch to standard TestBed api for unit testing * test fixes * test fixes * test fixes * test fixes * test fixes * test fixes * test fixes * test fixes * test fixes
This commit is contained in:
@@ -17,12 +17,6 @@ module.exports = function (config) {
|
||||
},
|
||||
{ pattern: 'node_modules/chart.js/dist/Chart.js', included: true, watched: false },
|
||||
{ pattern: 'node_modules/raphael/raphael.min.js', included: true, watched: false },
|
||||
{
|
||||
pattern: 'node_modules/ng2-charts/bundles/ng2-charts.umd.js',
|
||||
included: false,
|
||||
served: true,
|
||||
watched: false
|
||||
},
|
||||
{ pattern: 'node_modules/moment/min/moment.min.js', included: true, watched: false },
|
||||
{ pattern: 'lib/core/src/lib/i18n/**/en.json', included: false, served: true, watched: false },
|
||||
{ pattern: 'lib/process-services-cloud/src/lib/i18n/*.json', included: false, served: true, watched: false },
|
||||
|
||||
+7
-10
@@ -16,8 +16,6 @@
|
||||
*/
|
||||
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { setupTestBed } from '@alfresco/adf-core';
|
||||
|
||||
import { fakeApplicationInstance } from '../mock/app-model.mock';
|
||||
import { AppDetailsCloudComponent } from './app-details-cloud.component';
|
||||
import { ProcessServiceCloudTestingModule } from '../../testing/process-service-cloud.testing.module';
|
||||
@@ -30,15 +28,14 @@ describe('AppDetailsCloudComponent', () => {
|
||||
let component: AppDetailsCloudComponent;
|
||||
let fixture: ComponentFixture<AppDetailsCloudComponent>;
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule,
|
||||
AppListCloudModule
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule,
|
||||
AppListCloudModule
|
||||
]
|
||||
});
|
||||
fixture = TestBed.createComponent(AppDetailsCloudComponent);
|
||||
component = fixture.componentInstance;
|
||||
component.applicationInstance = fakeApplicationInstance[0];
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
import { Component } from '@angular/core';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { setupTestBed, AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { of, throwError } from 'rxjs';
|
||||
|
||||
import { fakeApplicationInstance } from '../mock/app-model.mock';
|
||||
@@ -55,15 +55,14 @@ describe('AppListCloudComponent', () => {
|
||||
class CustomEmptyAppListCloudTemplateComponent {
|
||||
}
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
],
|
||||
declarations: [CustomEmptyAppListCloudTemplateComponent]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
],
|
||||
declarations: [CustomEmptyAppListCloudTemplateComponent]
|
||||
});
|
||||
fixture = TestBed.createComponent(AppListCloudComponent);
|
||||
component = fixture.componentInstance;
|
||||
alfrescoApiService = TestBed.inject(AlfrescoApiService);
|
||||
|
||||
+12
-13
@@ -17,7 +17,7 @@
|
||||
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { throwError } from 'rxjs';
|
||||
import { setupTestBed, AppConfigService, AlfrescoApiService, CoreTestingModule } from '@alfresco/adf-core';
|
||||
import { AppConfigService, AlfrescoApiService, CoreTestingModule } from '@alfresco/adf-core';
|
||||
import { HttpErrorResponse } from '@angular/common/http';
|
||||
import { AppsProcessCloudService } from './apps-process-cloud.service';
|
||||
import { fakeApplicationInstance, fakeApplicationInstanceWithEnvironment } from '../mock/app-model.mock';
|
||||
@@ -34,19 +34,18 @@ describe('AppsProcessCloudService', () => {
|
||||
|
||||
const apiMockResponse: any = Promise.resolve({list : { entries: [ {entry: fakeApplicationInstance[0]}, {entry: fakeApplicationInstance[1]}] }});
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
CoreTestingModule,
|
||||
ProcessServiceCloudTestingModule
|
||||
],
|
||||
providers: [
|
||||
AlfrescoApiService,
|
||||
AppConfigService
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
CoreTestingModule,
|
||||
ProcessServiceCloudTestingModule
|
||||
],
|
||||
providers: [
|
||||
AlfrescoApiService,
|
||||
AppConfigService
|
||||
]
|
||||
});
|
||||
adfHttpClient = TestBed.inject(AdfHttpClient);
|
||||
spyOn(adfHttpClient, 'request').and.returnValue(apiMockResponse);
|
||||
|
||||
|
||||
+6
-8
@@ -17,7 +17,6 @@
|
||||
|
||||
import { DateRangeFilterComponent } from './date-range-filter.component';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { setupTestBed } from '@alfresco/adf-core';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { ProcessServiceCloudTestingModule } from '../../testing/process-service-cloud.testing.module';
|
||||
import { MatSelectChange } from '@angular/material/select';
|
||||
@@ -31,14 +30,13 @@ describe('DateRangeFilterComponent', () => {
|
||||
let fixture: ComponentFixture<DateRangeFilterComponent>;
|
||||
let service: DateRangeFilterService;
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
]
|
||||
});
|
||||
fixture = TestBed.createComponent(DateRangeFilterComponent);
|
||||
component = fixture.componentInstance;
|
||||
service = TestBed.inject(DateRangeFilterService);
|
||||
|
||||
+9
-15
@@ -15,13 +15,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import {
|
||||
FormModel, setupTestBed
|
||||
} from '@alfresco/adf-core';
|
||||
import {
|
||||
Component,
|
||||
DebugElement, ViewChild
|
||||
} from '@angular/core';
|
||||
import { FormModel } 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 { TranslateModule } from '@ngx-translate/core';
|
||||
@@ -60,15 +55,14 @@ describe('FormCloudWithCustomOutComesComponent', () => {
|
||||
let customComponent: FormCloudWithCustomOutComesComponent;
|
||||
let debugElement: DebugElement;
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
],
|
||||
declarations: [FormCloudWithCustomOutComesComponent]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
],
|
||||
declarations: [FormCloudWithCustomOutComesComponent]
|
||||
});
|
||||
fixture = TestBed.createComponent(FormCloudWithCustomOutComesComponent);
|
||||
customComponent = fixture.componentInstance;
|
||||
debugElement = fixture.debugElement;
|
||||
|
||||
@@ -24,7 +24,7 @@ import {
|
||||
FormFieldTypes,
|
||||
FormModel,
|
||||
FormOutcomeEvent,
|
||||
FormOutcomeModel, FormRenderingService, FormService, setupTestBed,
|
||||
FormOutcomeModel, FormRenderingService, FormService,
|
||||
TRANSLATION_PROVIDER, UploadWidgetContentLinkModel, WidgetVisibilityService
|
||||
} from '@alfresco/adf-core';
|
||||
import { Node } from '@alfresco/js-api';
|
||||
@@ -92,20 +92,19 @@ describe('FormCloudComponent', () => {
|
||||
return componentRef.instance;
|
||||
};
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
ProcessServiceCloudTestingModule
|
||||
],
|
||||
providers: [
|
||||
{
|
||||
provide: VersionCompatibilityService,
|
||||
useValue: {}
|
||||
},
|
||||
{ provide: FormRenderingService, useClass: CloudFormRenderingService }
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
ProcessServiceCloudTestingModule
|
||||
],
|
||||
providers: [
|
||||
{
|
||||
provide: VersionCompatibilityService,
|
||||
useValue: {}
|
||||
},
|
||||
{ provide: FormRenderingService, useClass: CloudFormRenderingService }
|
||||
]
|
||||
});
|
||||
const apiService = TestBed.inject(AlfrescoApiService);
|
||||
spyOn(apiService, 'getInstance').and.returnValue(mockOauth2Auth);
|
||||
|
||||
@@ -1148,25 +1147,24 @@ describe('Multilingual Form', () => {
|
||||
let formComponent: FormCloudComponent;
|
||||
let fixture: ComponentFixture<FormCloudComponent>;
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
NoopAnimationsModule,
|
||||
TranslateModule.forRoot(),
|
||||
CoreModule.forRoot()
|
||||
],
|
||||
providers: [
|
||||
{
|
||||
provide: TRANSLATION_PROVIDER,
|
||||
multi: true,
|
||||
useValue: {
|
||||
name: 'app',
|
||||
source: 'resources'
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
NoopAnimationsModule,
|
||||
TranslateModule.forRoot(),
|
||||
CoreModule.forRoot()
|
||||
],
|
||||
providers: [
|
||||
{
|
||||
provide: TRANSLATION_PROVIDER,
|
||||
multi: true,
|
||||
useValue: {
|
||||
name: 'app',
|
||||
source: 'resources'
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
translateService = TestBed.inject(TranslateService);
|
||||
formCloudService = TestBed.inject(FormCloudService);
|
||||
|
||||
@@ -1214,30 +1212,6 @@ describe('Multilingual Form', () => {
|
||||
});
|
||||
|
||||
describe('retrieve metadata on submit', () => {
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
NoopAnimationsModule,
|
||||
TranslateModule.forRoot(),
|
||||
CoreModule.forRoot(),
|
||||
FormCloudModule
|
||||
],
|
||||
providers: [
|
||||
{
|
||||
provide: TRANSLATION_PROVIDER,
|
||||
multi: true,
|
||||
useValue: {
|
||||
name: 'app',
|
||||
source: 'resources'
|
||||
}
|
||||
},
|
||||
{
|
||||
provide: VersionCompatibilityService,
|
||||
useValue: {}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
let formComponent: FormCloudComponent;
|
||||
let fixture: ComponentFixture<FormCloudComponent>;
|
||||
let formService: FormService;
|
||||
@@ -1255,6 +1229,28 @@ describe('retrieve metadata on submit', () => {
|
||||
} as Node;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
NoopAnimationsModule,
|
||||
TranslateModule.forRoot(),
|
||||
CoreModule.forRoot(),
|
||||
FormCloudModule
|
||||
],
|
||||
providers: [
|
||||
{
|
||||
provide: TRANSLATION_PROVIDER,
|
||||
multi: true,
|
||||
useValue: {
|
||||
name: 'app',
|
||||
source: 'resources'
|
||||
}
|
||||
},
|
||||
{
|
||||
provide: VersionCompatibilityService,
|
||||
useValue: {}
|
||||
}
|
||||
]
|
||||
});
|
||||
const apiService = TestBed.inject(AlfrescoApiService);
|
||||
spyOn(apiService, 'getInstance').and.returnValue(mockOauth2Auth);
|
||||
|
||||
|
||||
+7
-9
@@ -16,7 +16,6 @@
|
||||
*/
|
||||
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { setupTestBed } from '@alfresco/adf-core';
|
||||
import { ProcessServiceCloudTestingModule } from '../../testing/process-service-cloud.testing.module';
|
||||
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
import { FormDefinitionSelectorCloudComponent } from './form-definition-selector-cloud.component';
|
||||
@@ -32,15 +31,14 @@ describe('FormDefinitionCloudComponent', () => {
|
||||
let element: HTMLElement;
|
||||
let getFormsSpy: jasmine.Spy;
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
});
|
||||
fixture = TestBed.createComponent(FormDefinitionSelectorCloudComponent);
|
||||
element = fixture.nativeElement;
|
||||
service = TestBed.inject(FormDefinitionSelectorCloudService);
|
||||
|
||||
+9
-11
@@ -21,7 +21,6 @@ import { ContentCloudNodeSelectorService } from '../../../services/content-cloud
|
||||
import { ProcessCloudContentService } from '../../../services/process-cloud-content.service';
|
||||
import { AttachFileCloudWidgetComponent } from './attach-file-cloud-widget.component';
|
||||
import {
|
||||
setupTestBed,
|
||||
FormFieldModel,
|
||||
FormModel,
|
||||
FormFieldTypes,
|
||||
@@ -133,17 +132,16 @@ describe('AttachFileCloudWidgetComponent', () => {
|
||||
attachButton.click();
|
||||
};
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule,
|
||||
FormCloudModule,
|
||||
ContentModule.forRoot()
|
||||
],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule,
|
||||
FormCloudModule,
|
||||
ContentModule.forRoot()
|
||||
],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
});
|
||||
downloadService = TestBed.inject(DownloadService);
|
||||
fixture = TestBed.createComponent(AttachFileCloudWidgetComponent);
|
||||
widget = fixture.componentInstance;
|
||||
|
||||
+7
-8
@@ -17,7 +17,7 @@
|
||||
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { DateCloudWidgetComponent } from './date-cloud.widget';
|
||||
import { setupTestBed, FormFieldModel, FormModel, FormFieldTypes } from '@alfresco/adf-core';
|
||||
import { FormFieldModel, FormModel, FormFieldTypes } from '@alfresco/adf-core';
|
||||
import moment from 'moment';
|
||||
import { ProcessServiceCloudTestingModule } from '../../../../testing/process-service-cloud.testing.module';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
@@ -30,14 +30,13 @@ describe('DateWidgetComponent', () => {
|
||||
let fixture: ComponentFixture<DateCloudWidgetComponent>;
|
||||
let element: HTMLElement;
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
]
|
||||
});
|
||||
fixture = TestBed.createComponent(DateCloudWidgetComponent);
|
||||
widget = fixture.componentInstance;
|
||||
element = fixture.nativeElement;
|
||||
|
||||
+6
-7
@@ -18,7 +18,7 @@
|
||||
import { DebugElement } from '@angular/core';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { CoreTestingModule, setupTestBed } from '@alfresco/adf-core';
|
||||
import { CoreTestingModule } from '@alfresco/adf-core';
|
||||
|
||||
import { DisplayRichTextWidgetComponent } from './display-rich-text.widget';
|
||||
|
||||
@@ -61,13 +61,12 @@ describe('DisplayRichTextWidgetComponent', () => {
|
||||
}
|
||||
};
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
CoreTestingModule
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
CoreTestingModule
|
||||
]
|
||||
});
|
||||
fixture = TestBed.createComponent(DisplayRichTextWidgetComponent);
|
||||
widget = fixture.componentInstance;
|
||||
debugEl = fixture.debugElement;
|
||||
|
||||
+6
-8
@@ -23,7 +23,6 @@ import {
|
||||
FormFieldModel,
|
||||
FormModel,
|
||||
FormService,
|
||||
setupTestBed,
|
||||
FormFieldEvent,
|
||||
FormFieldTypes,
|
||||
LogService
|
||||
@@ -63,14 +62,13 @@ describe('DropdownCloudWidgetComponent', () => {
|
||||
fixture.detectChanges();
|
||||
};
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
]
|
||||
});
|
||||
fixture = TestBed.createComponent(DropdownCloudWidgetComponent);
|
||||
widget = fixture.componentInstance;
|
||||
element = fixture.nativeElement;
|
||||
|
||||
+13
-14
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { FormFieldModel, FormFieldTypes, FormModel, IdentityGroupModel, setupTestBed } from '@alfresco/adf-core';
|
||||
import { FormFieldModel, FormFieldTypes, FormModel, IdentityGroupModel } 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';
|
||||
@@ -28,20 +28,19 @@ describe('GroupCloudWidgetComponent', () => {
|
||||
let widget: GroupCloudWidgetComponent;
|
||||
let element: HTMLElement;
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
],
|
||||
declarations: [
|
||||
GroupCloudWidgetComponent
|
||||
],
|
||||
schemas: [
|
||||
CUSTOM_ELEMENTS_SCHEMA
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
],
|
||||
declarations: [
|
||||
GroupCloudWidgetComponent
|
||||
],
|
||||
schemas: [
|
||||
CUSTOM_ELEMENTS_SCHEMA
|
||||
]
|
||||
});
|
||||
fixture = TestBed.createComponent(GroupCloudWidgetComponent);
|
||||
widget = fixture.componentInstance;
|
||||
element = fixture.nativeElement;
|
||||
|
||||
+13
-14
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { FormFieldModel, FormFieldTypes, FormModel, IdentityUserModel, setupTestBed } from '@alfresco/adf-core';
|
||||
import { FormFieldModel, FormFieldTypes, FormModel, IdentityUserModel } from '@alfresco/adf-core';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { PeopleCloudWidgetComponent } from './people-cloud.widget';
|
||||
@@ -31,20 +31,19 @@ describe('PeopleCloudWidgetComponent', () => {
|
||||
let element: HTMLElement;
|
||||
let identityUserService: IdentityUserService;
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
],
|
||||
declarations: [
|
||||
PeopleCloudWidgetComponent
|
||||
],
|
||||
schemas: [
|
||||
CUSTOM_ELEMENTS_SCHEMA
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
],
|
||||
declarations: [
|
||||
PeopleCloudWidgetComponent
|
||||
],
|
||||
schemas: [
|
||||
CUSTOM_ELEMENTS_SCHEMA
|
||||
]
|
||||
});
|
||||
identityUserService = TestBed.inject(IdentityUserService);
|
||||
fixture = TestBed.createComponent(PeopleCloudWidgetComponent);
|
||||
widget = fixture.componentInstance;
|
||||
|
||||
+10
-14
@@ -16,9 +16,6 @@
|
||||
*/
|
||||
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import {
|
||||
setupTestBed
|
||||
} from '@alfresco/adf-core';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { PropertiesViewerWrapperComponent } from './properties-viewer-wrapper.component';
|
||||
import { ProcessServiceCloudTestingModule } from '../../../../../testing/process-service-cloud.testing.module';
|
||||
@@ -31,18 +28,17 @@ describe('PropertiesViewerWidgetComponent', () => {
|
||||
let fixture: ComponentFixture<PropertiesViewerWrapperComponent>;
|
||||
let nodesApiService: NodesApiService;
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
],
|
||||
providers: [
|
||||
NodesApiService,
|
||||
{ provide: BasicPropertiesService, useValue: { getProperties: () => [] } }
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
],
|
||||
providers: [
|
||||
NodesApiService,
|
||||
{ provide: BasicPropertiesService, useValue: { getProperties: () => [] } }
|
||||
]
|
||||
});
|
||||
fixture = TestBed.createComponent(PropertiesViewerWrapperComponent);
|
||||
component = fixture.componentInstance;
|
||||
|
||||
|
||||
+12
-17
@@ -16,11 +16,7 @@
|
||||
*/
|
||||
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import {
|
||||
FormFieldModel,
|
||||
FormModel,
|
||||
setupTestBed
|
||||
} from '@alfresco/adf-core';
|
||||
import { FormFieldModel, FormModel } from '@alfresco/adf-core';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { PropertiesViewerWidgetComponent } from './properties-viewer.widget';
|
||||
import { ProcessServiceCloudTestingModule } from '../../../../testing/process-service-cloud.testing.module';
|
||||
@@ -50,19 +46,18 @@ describe('PropertiesViewerWidgetComponent', () => {
|
||||
createdBy: { id: 1001, firstName: 'Admin', lastName: 'admin', email: 'admin@example.com' }
|
||||
};
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
],
|
||||
declarations: [PropertiesViewerWrapperComponent],
|
||||
providers: [
|
||||
NodesApiService,
|
||||
{ provide: BasicPropertiesService, useValue: { getProperties: () => [] } }
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
],
|
||||
declarations: [PropertiesViewerWrapperComponent],
|
||||
providers: [
|
||||
NodesApiService,
|
||||
{ provide: BasicPropertiesService, useValue: { getProperties: () => [] } }
|
||||
]
|
||||
});
|
||||
fixture = TestBed.createComponent(PropertiesViewerWidgetComponent);
|
||||
nodesApiService = TestBed.inject(NodesApiService);
|
||||
widget = fixture.componentInstance;
|
||||
|
||||
+7
-8
@@ -17,7 +17,7 @@
|
||||
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { FormFieldModel, FormFieldOption, FormFieldTypes, FormModel, setupTestBed } from '@alfresco/adf-core';
|
||||
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';
|
||||
@@ -40,14 +40,13 @@ describe('RadioButtonsCloudWidgetComponent', () => {
|
||||
}
|
||||
];
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
]
|
||||
});
|
||||
formCloudService = TestBed.inject(FormCloudService);
|
||||
fixture = TestBed.createComponent(RadioButtonsCloudWidgetComponent);
|
||||
widget = fixture.componentInstance;
|
||||
|
||||
+7
-8
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { AlfrescoApiService, AlfrescoApiServiceMock, NotificationService, setupTestBed } from '@alfresco/adf-core';
|
||||
import { AlfrescoApiService, AlfrescoApiServiceMock, NotificationService } from '@alfresco/adf-core';
|
||||
import { ProcessServiceCloudTestingModule } from '../../testing/process-service-cloud.testing.module';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { MatDialog, MatDialogModule } from '@angular/material/dialog';
|
||||
@@ -49,14 +49,13 @@ describe('ContentCloudNodeSelectorService', () => {
|
||||
}
|
||||
};
|
||||
|
||||
setupTestBed({
|
||||
imports: [TranslateModule.forRoot(), ProcessServiceCloudTestingModule, MatDialogModule],
|
||||
providers: [
|
||||
{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [TranslateModule.forRoot(), ProcessServiceCloudTestingModule, MatDialogModule],
|
||||
providers: [
|
||||
{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }
|
||||
]
|
||||
});
|
||||
service = TestBed.inject(ContentCloudNodeSelectorService);
|
||||
notificationService = TestBed.inject(NotificationService);
|
||||
dialog = TestBed.inject(MatDialog);
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { FormCloudService } from './form-cloud.service';
|
||||
import { setupTestBed } from '@alfresco/adf-core';
|
||||
import { of } from 'rxjs';
|
||||
import { ProcessServiceCloudTestingModule } from '../../testing/process-service-cloud.testing.module';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
@@ -39,14 +38,13 @@ describe('Form Cloud service', () => {
|
||||
const taskId = 'task-id';
|
||||
const processInstanceId = 'process-instance-id';
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
]
|
||||
});
|
||||
service = TestBed.inject(FormCloudService);
|
||||
adfHttpClient = TestBed.inject(AdfHttpClient);
|
||||
requestSpy = spyOn(adfHttpClient, 'request');
|
||||
|
||||
+6
-8
@@ -16,7 +16,6 @@
|
||||
*/
|
||||
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { setupTestBed } from '@alfresco/adf-core';
|
||||
import { FormDefinitionSelectorCloudService } from './form-definition-selector-cloud.service';
|
||||
import { ProcessServiceCloudTestingModule } from '../../testing/process-service-cloud.testing.module';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
@@ -29,14 +28,13 @@ describe('Form Definition Selector Cloud Service', () => {
|
||||
let adfHttpClient: AdfHttpClient;
|
||||
const appName = 'app-name';
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
]
|
||||
});
|
||||
service = TestBed.inject(FormDefinitionSelectorCloudService);
|
||||
adfHttpClient = TestBed.inject(AdfHttpClient);
|
||||
spyOn(adfHttpClient, 'request').and.returnValue(Promise.resolve(mockFormRepresentations));
|
||||
|
||||
@@ -19,13 +19,9 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { of } from 'rxjs';
|
||||
import { ProcessServiceCloudTestingModule } from './../../testing/process-service-cloud.testing.module';
|
||||
|
||||
import { GroupCloudModule } from '../group-cloud.module';
|
||||
import { GroupCloudComponent } from './group-cloud.component';
|
||||
import {
|
||||
setupTestBed,
|
||||
CoreTestingModule
|
||||
} from '@alfresco/adf-core';
|
||||
import { CoreTestingModule } from '@alfresco/adf-core';
|
||||
import { SimpleChange } from '@angular/core';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { IdentityGroupService } from '../services/identity-group.service';
|
||||
@@ -72,16 +68,15 @@ describe('GroupCloudComponent', () => {
|
||||
return fixture.debugElement.queryAll(By.css('[data-automation-id="adf-cloud-group-row"]'));
|
||||
}
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
CoreTestingModule,
|
||||
ProcessServiceCloudTestingModule,
|
||||
GroupCloudModule
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
CoreTestingModule,
|
||||
ProcessServiceCloudTestingModule,
|
||||
GroupCloudModule
|
||||
]
|
||||
});
|
||||
fixture = TestBed.createComponent(GroupCloudComponent);
|
||||
component = fixture.componentInstance;
|
||||
element = fixture.nativeElement;
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { setupTestBed } from '@alfresco/adf-core';
|
||||
import { ProcessServiceCloudTestingModule } from '../../testing/process-service-cloud.testing.module';
|
||||
import { IdentityGroupService } from './identity-group.service';
|
||||
import {
|
||||
@@ -35,14 +34,13 @@ describe('IdentityGroupService', () => {
|
||||
let adfHttpClient: AdfHttpClient;
|
||||
let requestSpy: jasmine.Spy;
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
]
|
||||
});
|
||||
service = TestBed.inject(IdentityGroupService);
|
||||
adfHttpClient = TestBed.inject(AdfHttpClient);
|
||||
requestSpy = spyOn(adfHttpClient, 'request');
|
||||
|
||||
+9
-10
@@ -17,7 +17,7 @@
|
||||
|
||||
import { PeopleCloudComponent } from './people-cloud.component';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { setupTestBed, CoreTestingModule } from '@alfresco/adf-core';
|
||||
import { CoreTestingModule } from '@alfresco/adf-core';
|
||||
import { ProcessServiceCloudTestingModule } from '../../testing/process-service-cloud.testing.module';
|
||||
import { PeopleCloudModule } from '../people-cloud.module';
|
||||
import { DebugElement, SimpleChange } from '@angular/core';
|
||||
@@ -83,16 +83,15 @@ describe('PeopleCloudComponent', () => {
|
||||
return element.querySelector('[data-automation-id="adf-people-cloud-row"]');
|
||||
}
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
CoreTestingModule,
|
||||
ProcessServiceCloudTestingModule,
|
||||
PeopleCloudModule
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
CoreTestingModule,
|
||||
ProcessServiceCloudTestingModule,
|
||||
PeopleCloudModule
|
||||
]
|
||||
});
|
||||
fixture = TestBed.createComponent(PeopleCloudComponent);
|
||||
component = fixture.componentInstance;
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { JwtHelperService, setupTestBed } from '@alfresco/adf-core';
|
||||
import { JwtHelperService } from '@alfresco/adf-core';
|
||||
import { IdentityUserService } from './identity-user.service';
|
||||
import { mockToken } from '../mock/jwt-helper.service.spec';
|
||||
import { ProcessServiceCloudTestingModule } from '../../testing/process-service-cloud.testing.module';
|
||||
@@ -40,14 +40,13 @@ describe('IdentityUserService', () => {
|
||||
let adfHttpClient: AdfHttpClient;
|
||||
let requestSpy: jasmine.Spy;
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
]
|
||||
});
|
||||
service = TestBed.inject(IdentityUserService);
|
||||
adfHttpClient = TestBed.inject(AdfHttpClient);
|
||||
requestSpy = spyOn(adfHttpClient, 'request');
|
||||
|
||||
@@ -19,7 +19,7 @@ import { TestBed } from '@angular/core/testing';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import moment from 'moment';
|
||||
import { ProcessNameCloudPipe } from './process-name-cloud.pipe';
|
||||
import { setupTestBed, LocalizedDatePipe, CoreTestingModule } from '@alfresco/adf-core';
|
||||
import { LocalizedDatePipe, CoreTestingModule } from '@alfresco/adf-core';
|
||||
import { ProcessInstanceCloud } from '../process/start-process/models/process-instance-cloud.model';
|
||||
|
||||
describe('ProcessNameCloudPipe', () => {
|
||||
@@ -35,14 +35,13 @@ describe('ProcessNameCloudPipe', () => {
|
||||
const nameWithAllIdentifiers = `${defaultName} ${processDefinitionIdentifier} - ${datetimeIdentifier}`;
|
||||
const fakeProcessInstanceDetails: ProcessInstanceCloud = { processDefinitionName: 'my-process-definition' };
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
CoreTestingModule
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
CoreTestingModule
|
||||
]
|
||||
});
|
||||
const localizedDatePipe = TestBed.inject(LocalizedDatePipe);
|
||||
processNamePipe = new ProcessNameCloudPipe(localizedDatePipe);
|
||||
});
|
||||
|
||||
+9
-11
@@ -17,7 +17,6 @@
|
||||
|
||||
import { Component, ViewChild } from '@angular/core';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { setupTestBed } from '@alfresco/adf-core';
|
||||
import { CancelProcessDirective } from './cancel-process.directive';
|
||||
import { ProcessServiceCloudTestingModule } from '../../testing/process-service-cloud.testing.module';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
@@ -43,17 +42,16 @@ describe('CancelProcessDirective', () => {
|
||||
let identityUserService: IdentityUserService;
|
||||
let component: TestComponent;
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
],
|
||||
declarations: [
|
||||
TestComponent
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
],
|
||||
declarations: [
|
||||
TestComponent
|
||||
]
|
||||
});
|
||||
fixture = TestBed.createComponent(TestComponent);
|
||||
component = fixture.componentInstance;
|
||||
identityUserService = TestBed.inject(IdentityUserService);
|
||||
|
||||
+13
-15
@@ -18,8 +18,7 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { SimpleChange } from '@angular/core';
|
||||
import { By } from '@angular/platform-browser';
|
||||
|
||||
import { setupTestBed, AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { ProcessServiceCloudTestingModule } from '../../../testing/process-service-cloud.testing.module';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { of } from 'rxjs';
|
||||
@@ -75,20 +74,19 @@ describe('EditProcessFilterCloudComponent', () => {
|
||||
reply: jasmine.createSpy('reply')
|
||||
};
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessFiltersCloudModule,
|
||||
ProcessServiceCloudTestingModule,
|
||||
MatIconTestingModule
|
||||
],
|
||||
providers: [
|
||||
MatDialog,
|
||||
{ provide: PROCESS_FILTERS_SERVICE_TOKEN, useClass: LocalPreferenceCloudService }
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessFiltersCloudModule,
|
||||
ProcessServiceCloudTestingModule,
|
||||
MatIconTestingModule
|
||||
],
|
||||
providers: [
|
||||
MatDialog,
|
||||
{ provide: PROCESS_FILTERS_SERVICE_TOKEN, useClass: LocalPreferenceCloudService }
|
||||
]
|
||||
});
|
||||
fixture = TestBed.createComponent(EditProcessFilterCloudComponent);
|
||||
component = fixture.componentInstance;
|
||||
service = TestBed.inject(ProcessFilterCloudService);
|
||||
|
||||
+11
-13
@@ -18,7 +18,6 @@
|
||||
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 { setupTestBed } from '@alfresco/adf-core';
|
||||
import { ProcessServiceCloudTestingModule } from '../../../testing/process-service-cloud.testing.module';
|
||||
import { ProcessFiltersCloudModule } from '../process-filters-cloud.module';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
@@ -36,19 +35,18 @@ describe('ProcessFilterDialogCloudComponent', () => {
|
||||
data: {name: 'Mock-Title'}
|
||||
};
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule,
|
||||
ProcessFiltersCloudModule
|
||||
],
|
||||
providers: [
|
||||
{ provide: MatDialogRef, useValue: mockDialogRef },
|
||||
{ provide: MAT_DIALOG_DATA, useValue: mockDialogData }
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule,
|
||||
ProcessFiltersCloudModule
|
||||
],
|
||||
providers: [
|
||||
{ provide: MatDialogRef, useValue: mockDialogRef },
|
||||
{ provide: MAT_DIALOG_DATA, useValue: mockDialogData }
|
||||
]
|
||||
});
|
||||
fixture = TestBed.createComponent(ProcessFilterDialogCloudComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
|
||||
+10
-12
@@ -17,7 +17,6 @@
|
||||
|
||||
import { SimpleChange } from '@angular/core';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { setupTestBed } from '@alfresco/adf-core';
|
||||
import { of, throwError } from 'rxjs';
|
||||
import { ProcessFilterCloudService } from '../services/process-filter-cloud.service';
|
||||
import { ProcessFiltersCloudComponent } from './process-filters-cloud.component';
|
||||
@@ -35,18 +34,17 @@ describe('ProcessFiltersCloudComponent', () => {
|
||||
let fixture: ComponentFixture<ProcessFiltersCloudComponent>;
|
||||
let getProcessFiltersSpy: jasmine.Spy;
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule,
|
||||
ProcessFiltersCloudModule
|
||||
],
|
||||
providers: [
|
||||
{ provide: PROCESS_FILTERS_SERVICE_TOKEN, useClass: LocalPreferenceCloudService }
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule,
|
||||
ProcessFiltersCloudModule
|
||||
],
|
||||
providers: [
|
||||
{ provide: PROCESS_FILTERS_SERVICE_TOKEN, useClass: LocalPreferenceCloudService }
|
||||
]
|
||||
});
|
||||
fixture = TestBed.createComponent(ProcessFiltersCloudComponent);
|
||||
component = fixture.componentInstance;
|
||||
|
||||
|
||||
+9
-11
@@ -16,7 +16,6 @@
|
||||
*/
|
||||
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { setupTestBed } from '@alfresco/adf-core';
|
||||
import { of } from 'rxjs';
|
||||
import { ProcessFilterCloudService } from './process-filter-cloud.service';
|
||||
import { PROCESS_FILTERS_SERVICE_TOKEN } from '../../../services/cloud-token.service';
|
||||
@@ -42,17 +41,16 @@ describe('ProcessFilterCloudService', () => {
|
||||
email: 'fakeIdentity@email.com'
|
||||
};
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
],
|
||||
providers: [
|
||||
{ provide: PROCESS_FILTERS_SERVICE_TOKEN, useClass: LocalPreferenceCloudService }
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
],
|
||||
providers: [
|
||||
{ provide: PROCESS_FILTERS_SERVICE_TOKEN, useClass: LocalPreferenceCloudService }
|
||||
]
|
||||
});
|
||||
service = TestBed.inject(ProcessFilterCloudService);
|
||||
|
||||
const preferenceCloudService = service.preferenceService;
|
||||
|
||||
+8
-9
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { setupTestBed, AppConfigService } from '@alfresco/adf-core';
|
||||
import { AppConfigService } from '@alfresco/adf-core';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { of } from 'rxjs';
|
||||
import { ProcessServiceCloudTestingModule } from '../../../testing/process-service-cloud.testing.module';
|
||||
@@ -32,15 +32,14 @@ describe('ProcessHeaderCloudComponent', () => {
|
||||
let service: ProcessCloudService;
|
||||
let appConfigService: AppConfigService;
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule,
|
||||
ProcessHeaderCloudModule
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule,
|
||||
ProcessHeaderCloudModule
|
||||
]
|
||||
});
|
||||
fixture = TestBed.createComponent(ProcessHeaderCloudComponent);
|
||||
component = fixture.componentInstance;
|
||||
service = TestBed.inject(ProcessCloudService);
|
||||
|
||||
+60
-59
@@ -26,8 +26,7 @@ import {
|
||||
DataRowEvent,
|
||||
DataTableModule,
|
||||
getDataColumnMock,
|
||||
ObjectDataRow,
|
||||
setupTestBed
|
||||
ObjectDataRow, User
|
||||
} from '@alfresco/adf-core';
|
||||
import { ProcessListCloudService } from '../services/process-list-cloud.service';
|
||||
import { ProcessListCloudComponent } from './process-list-cloud.component';
|
||||
@@ -62,6 +61,10 @@ import { PreferenceCloudServiceInterface } from '@alfresco/adf-process-services-
|
||||
class CustomTaskListComponent {
|
||||
@ViewChild(ProcessListCloudComponent)
|
||||
processListCloud: ProcessListCloudComponent;
|
||||
|
||||
getFullName(person: User): string {
|
||||
return `${person.firstName} ${person.lastName}`;
|
||||
}
|
||||
}
|
||||
|
||||
describe('ProcessListCloudComponent', () => {
|
||||
@@ -73,14 +76,13 @@ describe('ProcessListCloudComponent', () => {
|
||||
const fakeCustomSchemaName = 'fakeCustomSchema';
|
||||
const schemaWithVariable = 'schemaWithVariableId';
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
]
|
||||
});
|
||||
appConfig = TestBed.inject(AppConfigService);
|
||||
processListCloudService = TestBed.inject(ProcessListCloudService);
|
||||
preferencesService = TestBed.inject<PreferenceCloudServiceInterface>(PROCESS_LISTS_PREFERENCES_SERVICE_TOKEN);
|
||||
@@ -580,62 +582,64 @@ describe('ProcessListCloudComponent', () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe('Injecting custom colums for tasklist - CustomTaskListComponent', () => {
|
||||
|
||||
let fixtureCustom: ComponentFixture<CustomTaskListComponent>;
|
||||
let componentCustom: CustomTaskListComponent;
|
||||
});
|
||||
|
||||
setupTestBed({
|
||||
describe('ProcessListCloudComponent: Injecting custom columns for task list - CustomTaskListComponent', () => {
|
||||
let fixtureCustom: ComponentFixture<CustomTaskListComponent>;
|
||||
let componentCustom: CustomTaskListComponent;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
],
|
||||
declarations: [CustomTaskListComponent]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixtureCustom = TestBed.createComponent(CustomTaskListComponent);
|
||||
fixtureCustom.detectChanges();
|
||||
componentCustom = fixtureCustom.componentInstance;
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
fixtureCustom.destroy();
|
||||
});
|
||||
|
||||
it('should fetch custom schemaColumn from html', () => {
|
||||
fixture.detectChanges();
|
||||
expect(componentCustom.processListCloud.columnList).toBeDefined();
|
||||
expect(componentCustom.processListCloud.columns[0]['title']).toEqual('ADF_CLOUD_TASK_LIST.PROPERTIES.NAME');
|
||||
expect(componentCustom.processListCloud.columns[1]['title']).toEqual('ADF_CLOUD_TASK_LIST.PROPERTIES.CREATED');
|
||||
expect(componentCustom.processListCloud.columns.length).toEqual(3);
|
||||
});
|
||||
fixtureCustom = TestBed.createComponent(CustomTaskListComponent);
|
||||
fixtureCustom.detectChanges();
|
||||
componentCustom = fixtureCustom.componentInstance;
|
||||
});
|
||||
|
||||
describe('Creating an empty custom template - EmptyTemplateComponent', () => {
|
||||
afterEach(() => {
|
||||
fixtureCustom.destroy();
|
||||
});
|
||||
|
||||
@Component({
|
||||
template: `
|
||||
it('should fetch custom schemaColumn from html', () => {
|
||||
fixtureCustom.detectChanges();
|
||||
expect(componentCustom.processListCloud.columnList).toBeDefined();
|
||||
expect(componentCustom.processListCloud.columns[0]['title']).toEqual('ADF_CLOUD_TASK_LIST.PROPERTIES.NAME');
|
||||
expect(componentCustom.processListCloud.columns[1]['title']).toEqual('ADF_CLOUD_TASK_LIST.PROPERTIES.CREATED');
|
||||
expect(componentCustom.processListCloud.columns.length).toEqual(3);
|
||||
});
|
||||
});
|
||||
|
||||
describe('ProcessListCloudComponent: Creating an empty custom template - EmptyTemplateComponent', () => {
|
||||
let preferencesService: PreferenceCloudServiceInterface;
|
||||
@Component({
|
||||
template: `
|
||||
<adf-cloud-process-list #processListCloud>
|
||||
<adf-custom-empty-content-template>
|
||||
<p id="custom-id">TEST</p>
|
||||
</adf-custom-empty-content-template>
|
||||
</adf-cloud-process-list>
|
||||
`
|
||||
})
|
||||
})
|
||||
|
||||
class EmptyTemplateComponent {
|
||||
@ViewChild(ProcessListCloudComponent)
|
||||
processListCloud: ProcessListCloudComponent;
|
||||
}
|
||||
class EmptyTemplateComponent {
|
||||
@ViewChild(ProcessListCloudComponent)
|
||||
processListCloud: ProcessListCloudComponent;
|
||||
}
|
||||
|
||||
let fixtureEmpty: ComponentFixture<EmptyTemplateComponent>;
|
||||
preferencesService = jasmine.createSpyObj('preferencesService', {
|
||||
getPreferences: of({}),
|
||||
updatePreference: of({})
|
||||
});
|
||||
let fixtureEmpty: ComponentFixture<EmptyTemplateComponent>;
|
||||
preferencesService = jasmine.createSpyObj('preferencesService', {
|
||||
getPreferences: of({}),
|
||||
updatePreference: of({})
|
||||
});
|
||||
|
||||
setupTestBed({
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
HttpClientModule,
|
||||
@@ -646,24 +650,21 @@ describe('ProcessListCloudComponent', () => {
|
||||
providers: [{ provide: PROCESS_LISTS_PREFERENCES_SERVICE_TOKEN, useValue: preferencesService }],
|
||||
declarations: [EmptyTemplateComponent, ProcessListCloudComponent, CustomEmptyContentTemplateDirective]
|
||||
});
|
||||
fixtureEmpty = TestBed.createComponent(EmptyTemplateComponent);
|
||||
fixtureEmpty.detectChanges();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixtureEmpty = TestBed.createComponent(EmptyTemplateComponent);
|
||||
fixtureEmpty.detectChanges();
|
||||
});
|
||||
afterEach(() => {
|
||||
fixtureEmpty.destroy();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
fixtureEmpty.destroy();
|
||||
});
|
||||
it('should render the custom template', () => {
|
||||
fixtureEmpty.componentInstance.processListCloud.isLoading = false;
|
||||
|
||||
it('should render the custom template', () => {
|
||||
fixtureEmpty.componentInstance.processListCloud.isLoading = false;
|
||||
fixtureEmpty.detectChanges();
|
||||
|
||||
fixtureEmpty.detectChanges();
|
||||
expect(fixtureEmpty.debugElement.query(By.css('#custom-id'))).not.toBeNull();
|
||||
expect(fixtureEmpty.debugElement.query(By.css('.adf-empty-content'))).toBeNull();
|
||||
|
||||
expect(fixtureEmpty.debugElement.query(By.css('#custom-id'))).not.toBeNull();
|
||||
expect(fixtureEmpty.debugElement.query(By.css('.adf-empty-content'))).toBeNull();
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
+5
-7
@@ -16,7 +16,6 @@
|
||||
*/
|
||||
|
||||
import { fakeAsync, TestBed } from '@angular/core/testing';
|
||||
import { setupTestBed } from '@alfresco/adf-core';
|
||||
import { ProcessListCloudService } from './process-list-cloud.service';
|
||||
import { ProcessQueryCloudRequestModel } from '../models/process-cloud-query-request.model';
|
||||
import { ProcessServiceCloudTestingModule } from '../../../testing/process-service-cloud.testing.module';
|
||||
@@ -35,13 +34,12 @@ describe('ProcessListCloudService', () => {
|
||||
|
||||
const returnCallBody = (_queryUrl, options) => Promise.resolve(options.bodyParam);
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
ProcessServiceCloudTestingModule
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(fakeAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
ProcessServiceCloudTestingModule
|
||||
]
|
||||
});
|
||||
adfHttpClient = TestBed.inject(AdfHttpClient);
|
||||
service = TestBed.inject(ProcessListCloudService);
|
||||
requestSpy = spyOn(adfHttpClient, 'request');
|
||||
|
||||
+18
-19
@@ -17,7 +17,7 @@
|
||||
|
||||
import { SimpleChange, DebugElement } from '@angular/core';
|
||||
import { ComponentFixture, TestBed, fakeAsync, tick } from '@angular/core/testing';
|
||||
import { FormModel, setupTestBed } from '@alfresco/adf-core';
|
||||
import { FormModel } from '@alfresco/adf-core';
|
||||
import { of, throwError } from 'rxjs';
|
||||
import { StartProcessCloudService } from '../services/start-process-cloud.service';
|
||||
import { FormCloudService } from '../../../form/services/form-cloud.service';
|
||||
@@ -81,25 +81,24 @@ describe('StartProcessCloudComponent', () => {
|
||||
inputElement.nativeElement.dispatchEvent(new Event('input'));
|
||||
};
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule,
|
||||
FormsModule,
|
||||
MatCommonModule,
|
||||
ReactiveFormsModule,
|
||||
MatCardModule,
|
||||
MatIconModule,
|
||||
MatAutocompleteModule,
|
||||
MatOptionModule,
|
||||
MatButtonModule,
|
||||
MatFormFieldModule,
|
||||
MatInputModule,
|
||||
MatRippleModule
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule,
|
||||
FormsModule,
|
||||
MatCommonModule,
|
||||
ReactiveFormsModule,
|
||||
MatCardModule,
|
||||
MatIconModule,
|
||||
MatAutocompleteModule,
|
||||
MatOptionModule,
|
||||
MatButtonModule,
|
||||
MatFormFieldModule,
|
||||
MatInputModule,
|
||||
MatRippleModule
|
||||
]
|
||||
});
|
||||
processService = TestBed.inject(StartProcessCloudService);
|
||||
formCloudService = TestBed.inject(FormCloudService);
|
||||
fixture = TestBed.createComponent(StartProcessCloudComponent);
|
||||
|
||||
+3
-5
@@ -17,7 +17,6 @@
|
||||
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { of, throwError } from 'rxjs';
|
||||
import { setupTestBed } from '@alfresco/adf-core';
|
||||
import { StartProcessCloudService } from './start-process-cloud.service';
|
||||
import { fakeProcessPayload } from '../mock/start-process.component.mock';
|
||||
import { ProcessDefinitionCloud } from '../../../models/process-definition-cloud.model';
|
||||
@@ -29,11 +28,10 @@ describe('StartProcessCloudService', () => {
|
||||
let service: StartProcessCloudService;
|
||||
let adfHttpClient: AdfHttpClient;
|
||||
|
||||
setupTestBed({
|
||||
imports: [HttpClientModule]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [HttpClientModule]
|
||||
});
|
||||
service = TestBed.inject(StartProcessCloudService);
|
||||
adfHttpClient = TestBed.inject(AdfHttpClient);
|
||||
});
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
*/
|
||||
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { setupTestBed } from '@alfresco/adf-core';
|
||||
import { ProcessServiceCloudTestingModule } from '../testing/process-service-cloud.testing.module';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { NotificationCloudService } from './notification-cloud.service';
|
||||
@@ -43,14 +42,13 @@ describe('NotificationCloudService', () => {
|
||||
}
|
||||
`;
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
]
|
||||
});
|
||||
service = TestBed.inject(NotificationCloudService);
|
||||
apollo = TestBed.inject(Apollo);
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { UserPreferenceCloudService } from './user-preference-cloud.service';
|
||||
import { setupTestBed } from '@alfresco/adf-core';
|
||||
import { mockPreferences, getMockPreference, createMockPreference, updateMockPreference } from '../mock/user-preference.mock';
|
||||
import { ProcessServiceCloudTestingModule } from '../testing/process-service-cloud.testing.module';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
@@ -33,17 +32,16 @@ describe('PreferenceService', () => {
|
||||
state: 404, stateText: 'Not Found'
|
||||
};
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
service = TestBed.inject(UserPreferenceCloudService);
|
||||
adfHttpClient = TestBed.inject(AdfHttpClient);
|
||||
requestSpy = spyOn(adfHttpClient, 'request').and.returnValue(Promise.resolve(mockPreferences));
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
]
|
||||
});
|
||||
service = TestBed.inject(UserPreferenceCloudService);
|
||||
adfHttpClient = TestBed.inject(AdfHttpClient);
|
||||
requestSpy = spyOn(adfHttpClient, 'request').and.returnValue(Promise.resolve(mockPreferences));
|
||||
});
|
||||
|
||||
it('should return the preferences', (done) => {
|
||||
|
||||
+21
-24
@@ -17,7 +17,6 @@
|
||||
|
||||
import { Component, ContentChildren, ViewChild } from '@angular/core';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { setupTestBed } from '@alfresco/adf-core';
|
||||
import { TaskCloudService } from '../services/task-cloud.service';
|
||||
import { of, throwError } from 'rxjs';
|
||||
import { ClaimTaskCloudDirective } from './claim-task-cloud.directive';
|
||||
@@ -48,17 +47,16 @@ describe('ClaimTaskCloudDirective', () => {
|
||||
let fixture: ComponentFixture<TestComponent>;
|
||||
let taskCloudService: TaskCloudService;
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
],
|
||||
declarations: [
|
||||
TestComponent
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
],
|
||||
declarations: [
|
||||
TestComponent
|
||||
]
|
||||
});
|
||||
taskCloudService = TestBed.inject(TaskCloudService);
|
||||
fixture = TestBed.createComponent(TestComponent);
|
||||
fixture.detectChanges();
|
||||
@@ -158,20 +156,19 @@ describe('Claim Task Directive validation errors', () => {
|
||||
|
||||
let fixture: ComponentFixture<any>;
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
],
|
||||
declarations: [
|
||||
ClaimTestMissingTaskIdDirectiveComponent,
|
||||
ClaimTestInvalidAppNameUndefinedDirectiveComponent,
|
||||
ClaimTestInvalidAppNameNullDirectiveComponent,
|
||||
ClaimTestMissingInputDirectiveComponent
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
],
|
||||
declarations: [
|
||||
ClaimTestMissingTaskIdDirectiveComponent,
|
||||
ClaimTestInvalidAppNameUndefinedDirectiveComponent,
|
||||
ClaimTestInvalidAppNameNullDirectiveComponent,
|
||||
ClaimTestMissingInputDirectiveComponent
|
||||
]
|
||||
});
|
||||
fixture = TestBed.createComponent(ClaimTestMissingInputDirectiveComponent);
|
||||
});
|
||||
|
||||
|
||||
+21
-24
@@ -18,7 +18,6 @@
|
||||
import { Component, ViewChild, ContentChildren } from '@angular/core';
|
||||
import { CompleteTaskDirective } from './complete-task.directive';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { setupTestBed } from '@alfresco/adf-core';
|
||||
import { of, throwError } from 'rxjs';
|
||||
import { taskCompleteCloudMock } from '../task-header/mocks/fake-complete-task.mock';
|
||||
import { TaskCloudService } from '../services/task-cloud.service';
|
||||
@@ -52,17 +51,16 @@ describe('CompleteTaskDirective', () => {
|
||||
let fixture: ComponentFixture<TestComponent>;
|
||||
let taskCloudService: TaskCloudService;
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
],
|
||||
declarations: [
|
||||
TestComponent
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
],
|
||||
declarations: [
|
||||
TestComponent
|
||||
]
|
||||
});
|
||||
taskCloudService = TestBed.inject(TaskCloudService);
|
||||
fixture = TestBed.createComponent(TestComponent);
|
||||
fixture.detectChanges();
|
||||
@@ -178,20 +176,19 @@ describe('Complete Task Directive validation errors', () => {
|
||||
|
||||
let fixture: ComponentFixture<any>;
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
],
|
||||
declarations: [
|
||||
TestMissingTaskIdDirectiveComponent,
|
||||
TestInvalidAppNameUndefinedDirectiveComponent,
|
||||
TestInvalidAppNameNullDirectiveComponent,
|
||||
TestMissingInputDirectiveComponent
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
],
|
||||
declarations: [
|
||||
TestMissingTaskIdDirectiveComponent,
|
||||
TestInvalidAppNameUndefinedDirectiveComponent,
|
||||
TestInvalidAppNameNullDirectiveComponent,
|
||||
TestMissingInputDirectiveComponent
|
||||
]
|
||||
});
|
||||
fixture = TestBed.createComponent(TestMissingInputDirectiveComponent);
|
||||
});
|
||||
|
||||
|
||||
+21
-24
@@ -17,7 +17,6 @@
|
||||
|
||||
import { Component, ContentChildren, ViewChild } from '@angular/core';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { setupTestBed } from '@alfresco/adf-core';
|
||||
import { TaskCloudService } from '../services/task-cloud.service';
|
||||
import { of, throwError } from 'rxjs';
|
||||
import { UnClaimTaskCloudDirective } from './unclaim-task-cloud.directive';
|
||||
@@ -48,17 +47,16 @@ describe('UnClaimTaskCloudDirective', () => {
|
||||
let fixture: ComponentFixture<TestComponent>;
|
||||
let taskCloudService: TaskCloudService;
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
],
|
||||
declarations: [
|
||||
TestComponent
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
],
|
||||
declarations: [
|
||||
TestComponent
|
||||
]
|
||||
});
|
||||
taskCloudService = TestBed.inject(TaskCloudService);
|
||||
fixture = TestBed.createComponent(TestComponent);
|
||||
fixture.detectChanges();
|
||||
@@ -158,20 +156,19 @@ describe('UnClaim Task Directive validation errors', () => {
|
||||
|
||||
let fixture: ComponentFixture<any>;
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
],
|
||||
declarations: [
|
||||
ClaimTestMissingTaskIdDirectiveComponent,
|
||||
ClaimTestInvalidAppNameUndefinedDirectiveComponent,
|
||||
ClaimTestInvalidAppNameNullDirectiveComponent,
|
||||
ClaimTestMissingInputDirectiveComponent
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
],
|
||||
declarations: [
|
||||
ClaimTestMissingTaskIdDirectiveComponent,
|
||||
ClaimTestInvalidAppNameUndefinedDirectiveComponent,
|
||||
ClaimTestInvalidAppNameNullDirectiveComponent,
|
||||
ClaimTestMissingInputDirectiveComponent
|
||||
]
|
||||
});
|
||||
fixture = TestBed.createComponent(ClaimTestMissingInputDirectiveComponent);
|
||||
});
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { setupTestBed, TranslationService } from '@alfresco/adf-core';
|
||||
import { TranslationService } from '@alfresco/adf-core';
|
||||
import { TaskCloudService } from './task-cloud.service';
|
||||
import { taskCompleteCloudMock } from '../task-header/mocks/fake-complete-task.mock';
|
||||
import { assignedTaskDetailsCloudMock, createdTaskDetailsCloudMock, emptyOwnerTaskDetailsCloudMock } from '../task-header/mocks/task-details-cloud.mock';
|
||||
@@ -45,14 +45,13 @@ describe('Task Cloud Service', () => {
|
||||
|
||||
const returnFakeCandidateGroupResults = () => Promise.resolve(['mockgroup1', 'mockgroup2', 'mockgroup3']);
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
]
|
||||
});
|
||||
adfHttpClient = TestBed.inject(AdfHttpClient);
|
||||
identityUserService = TestBed.inject(IdentityUserService);
|
||||
translateService = TestBed.inject(TranslationService);
|
||||
|
||||
+8
-9
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { setupTestBed, AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { StartTaskCloudComponent } from './start-task-cloud.component';
|
||||
import { of, throwError } from 'rxjs';
|
||||
import { taskDetailsMock } from '../mock/task-details.mock';
|
||||
@@ -50,15 +50,14 @@ describe('StartTaskCloudComponent', () => {
|
||||
|
||||
const mockUser: IdentityUserModel = {username: 'currentUser', firstName: 'Test', lastName: 'User', email: 'currentUser@test.com'};
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
],
|
||||
schemas: [ CUSTOM_ELEMENTS_SCHEMA ]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
],
|
||||
schemas: [ CUSTOM_ELEMENTS_SCHEMA ]
|
||||
});
|
||||
fixture = TestBed.createComponent(StartTaskCloudComponent);
|
||||
component = fixture.componentInstance;
|
||||
element = fixture.nativeElement;
|
||||
|
||||
+6
-9
@@ -16,12 +16,10 @@
|
||||
*/
|
||||
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { of, throwError } from 'rxjs';
|
||||
import { taskDetailsMock } from '../mock/task-details.mock';
|
||||
import { TaskDetailsCloudModel } from '../models/task-details-cloud.model';
|
||||
import { HttpErrorResponse } from '@angular/common/http';
|
||||
import { setupTestBed } from '@alfresco/adf-core';
|
||||
import { TaskCloudService } from '../../services/task-cloud.service';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { ProcessServiceCloudTestingModule } from './../../../testing/process-service-cloud.testing.module';
|
||||
@@ -31,14 +29,13 @@ describe('StartTaskCloudService', () => {
|
||||
let service: TaskCloudService;
|
||||
const fakeAppName: string = 'fake-app';
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
]
|
||||
});
|
||||
service = TestBed.inject(TaskCloudService);
|
||||
});
|
||||
|
||||
|
||||
+12
-14
@@ -18,7 +18,6 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { SimpleChange } from '@angular/core';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { setupTestBed } from '@alfresco/adf-core';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { of, Subject } from 'rxjs';
|
||||
import { debounceTime } from 'rxjs/operators';
|
||||
@@ -50,20 +49,19 @@ describe('EditServiceTaskFilterCloudComponent', () => {
|
||||
let taskService: TaskCloudService;
|
||||
const afterClosedSubject = new Subject<any>();
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule,
|
||||
TaskFiltersCloudModule,
|
||||
MatIconTestingModule
|
||||
],
|
||||
providers: [
|
||||
MatDialog,
|
||||
{ provide: TASK_FILTERS_SERVICE_TOKEN, useClass: LocalPreferenceCloudService }
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule,
|
||||
TaskFiltersCloudModule,
|
||||
MatIconTestingModule
|
||||
],
|
||||
providers: [
|
||||
MatDialog,
|
||||
{ provide: TASK_FILTERS_SERVICE_TOKEN, useClass: LocalPreferenceCloudService }
|
||||
]
|
||||
});
|
||||
fixture = TestBed.createComponent(EditServiceTaskFilterCloudComponent);
|
||||
component = fixture.componentInstance;
|
||||
service = TestBed.inject(ServiceTaskFilterCloudService);
|
||||
|
||||
+14
-16
@@ -17,8 +17,7 @@
|
||||
|
||||
import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing';
|
||||
import { By } from '@angular/platform-browser';
|
||||
|
||||
import { AlfrescoApiService, setupTestBed } from '@alfresco/adf-core';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { of, Subject } from 'rxjs';
|
||||
import { debounceTime } from 'rxjs/operators';
|
||||
@@ -69,21 +68,20 @@ describe('EditTaskFilterCloudComponent', () => {
|
||||
let taskService: TaskCloudService;
|
||||
const afterClosedSubject = new Subject<any>();
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule,
|
||||
TaskFiltersCloudModule,
|
||||
PeopleCloudModule,
|
||||
MatIconTestingModule
|
||||
],
|
||||
providers: [
|
||||
MatDialog,
|
||||
{ provide: TASK_FILTERS_SERVICE_TOKEN, useClass: LocalPreferenceCloudService }
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule,
|
||||
TaskFiltersCloudModule,
|
||||
PeopleCloudModule,
|
||||
MatIconTestingModule
|
||||
],
|
||||
providers: [
|
||||
MatDialog,
|
||||
{ provide: TASK_FILTERS_SERVICE_TOKEN, useClass: LocalPreferenceCloudService }
|
||||
]
|
||||
});
|
||||
fixture = TestBed.createComponent(EditTaskFilterCloudComponent);
|
||||
component = fixture.componentInstance;
|
||||
service = TestBed.inject(TaskFilterCloudService);
|
||||
|
||||
+10
-12
@@ -17,7 +17,6 @@
|
||||
|
||||
import { SimpleChange } from '@angular/core';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { setupTestBed } from '@alfresco/adf-core';
|
||||
import { of, throwError } from 'rxjs';
|
||||
import { TASK_FILTERS_SERVICE_TOKEN } from '../../../services/cloud-token.service';
|
||||
import { LocalPreferenceCloudService } from '../../../services/local-preference-cloud.service';
|
||||
@@ -36,18 +35,17 @@ describe('ServiceTaskFiltersCloudComponent', () => {
|
||||
let component: ServiceTaskFiltersCloudComponent;
|
||||
let fixture: ComponentFixture<ServiceTaskFiltersCloudComponent>;
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule,
|
||||
TaskFiltersCloudModule
|
||||
],
|
||||
providers: [
|
||||
{ provide: TASK_FILTERS_SERVICE_TOKEN, useClass: LocalPreferenceCloudService }
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule,
|
||||
TaskFiltersCloudModule
|
||||
],
|
||||
providers: [
|
||||
{ provide: TASK_FILTERS_SERVICE_TOKEN, useClass: LocalPreferenceCloudService }
|
||||
]
|
||||
});
|
||||
fixture = TestBed.createComponent(ServiceTaskFiltersCloudComponent);
|
||||
component = fixture.componentInstance;
|
||||
|
||||
|
||||
+13
-11
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { setupTestBed, TranslationService, TranslationMock } from '@alfresco/adf-core';
|
||||
import { TranslationService, TranslationMock } from '@alfresco/adf-core';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { TaskAssignmentFilterCloudComponent } from './task-assignment-filter.component';
|
||||
import { GroupCloudModule } from '../../../../group/group-cloud.module';
|
||||
@@ -48,16 +48,18 @@ describe('TaskAssignmentFilterComponent', () => {
|
||||
expect(assignmentTypeChangeSpy).toHaveBeenCalledWith(type);
|
||||
}
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
GroupCloudModule,
|
||||
TaskFiltersCloudModule,
|
||||
NoopAnimationsModule
|
||||
],
|
||||
providers: [
|
||||
{ provide: TranslationService, useClass: TranslationMock }
|
||||
]
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
GroupCloudModule,
|
||||
TaskFiltersCloudModule,
|
||||
NoopAnimationsModule
|
||||
],
|
||||
providers: [
|
||||
{ provide: TranslationService, useClass: TranslationMock }
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
describe('inputs', () => {
|
||||
|
||||
+11
-13
@@ -19,7 +19,6 @@ 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 { TaskFiltersCloudModule } from '../../task-filters-cloud.module';
|
||||
import { setupTestBed } from '@alfresco/adf-core';
|
||||
import { ProcessServiceCloudTestingModule } from '../../../../testing/process-service-cloud.testing.module';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
|
||||
@@ -36,19 +35,18 @@ describe('TaskFilterDialogCloudComponent', () => {
|
||||
data: {name: 'Mock-Title'}
|
||||
};
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule,
|
||||
TaskFiltersCloudModule
|
||||
],
|
||||
providers: [
|
||||
{ provide: MatDialogRef, useValue: mockDialogRef },
|
||||
{ provide: MAT_DIALOG_DATA, useValue: mockDialogData }
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule,
|
||||
TaskFiltersCloudModule
|
||||
],
|
||||
providers: [
|
||||
{ provide: MatDialogRef, useValue: mockDialogRef },
|
||||
{ provide: MAT_DIALOG_DATA, useValue: mockDialogData }
|
||||
]
|
||||
});
|
||||
fixture = TestBed.createComponent(TaskFilterDialogCloudComponent);
|
||||
component = fixture.componentInstance;
|
||||
});
|
||||
|
||||
+10
-11
@@ -17,7 +17,7 @@
|
||||
|
||||
import { SimpleChange } from '@angular/core';
|
||||
import { ComponentFixture, TestBed, fakeAsync } from '@angular/core/testing';
|
||||
import { AppConfigService, setupTestBed } from '@alfresco/adf-core';
|
||||
import { AppConfigService } from '@alfresco/adf-core';
|
||||
import { of, throwError } from 'rxjs';
|
||||
import { TASK_FILTERS_SERVICE_TOKEN } from '../../../services/cloud-token.service';
|
||||
import { LocalPreferenceCloudService } from '../../../services/local-preference-cloud.service';
|
||||
@@ -37,17 +37,16 @@ describe('TaskFiltersCloudComponent', () => {
|
||||
let getTaskFilterCounterSpy: jasmine.Spy;
|
||||
let getTaskListFiltersSpy: jasmine.Spy;
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
ProcessServiceCloudTestingModule,
|
||||
TaskFiltersCloudModule
|
||||
],
|
||||
providers: [
|
||||
{ provide: TASK_FILTERS_SERVICE_TOKEN, useClass: LocalPreferenceCloudService }
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
ProcessServiceCloudTestingModule,
|
||||
TaskFiltersCloudModule
|
||||
],
|
||||
providers: [
|
||||
{ provide: TASK_FILTERS_SERVICE_TOKEN, useClass: LocalPreferenceCloudService }
|
||||
]
|
||||
});
|
||||
taskFilterService = TestBed.inject(TaskFilterCloudService);
|
||||
getTaskFilterCounterSpy = spyOn(taskFilterService, 'getTaskFilterCounter').and.returnValue(of(11));
|
||||
spyOn(taskFilterService, 'getTaskNotificationSubscription').and.returnValue(of(taskNotifications));
|
||||
|
||||
+16
-19
@@ -16,7 +16,6 @@
|
||||
*/
|
||||
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { setupTestBed } from '@alfresco/adf-core';
|
||||
import { of } from 'rxjs';
|
||||
import { TASK_FILTERS_SERVICE_TOKEN } from '../../../services/cloud-token.service';
|
||||
import { LocalPreferenceCloudService } from '../../../services/local-preference-cloud.service';
|
||||
@@ -50,18 +49,17 @@ describe('TaskFilterCloudService', () => {
|
||||
|
||||
const identityUserMock = { username: 'fakeusername', firstName: 'fake-identity-first-name', lastName: 'fake-identity-last-name', email: 'fakeIdentity@email.com' };
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
HttpClientTestingModule,
|
||||
ProcessServiceCloudTestingModule,
|
||||
ApolloModule
|
||||
],
|
||||
providers: [
|
||||
{ provide: TASK_FILTERS_SERVICE_TOKEN, useClass: UserPreferenceCloudService }
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
HttpClientTestingModule,
|
||||
ProcessServiceCloudTestingModule,
|
||||
ApolloModule
|
||||
],
|
||||
providers: [
|
||||
{ provide: TASK_FILTERS_SERVICE_TOKEN, useClass: UserPreferenceCloudService }
|
||||
]
|
||||
});
|
||||
service = TestBed.inject(TaskFilterCloudService);
|
||||
notificationCloudService = TestBed.inject(NotificationCloudService);
|
||||
|
||||
@@ -232,14 +230,13 @@ describe('Inject [LocalPreferenceCloudService] into the TaskFilterCloudService',
|
||||
|
||||
const identityUserMock = { username: 'fakeusername', firstName: 'fake-identity-first-name', lastName: 'fake-identity-last-name', email: 'fakeIdentity@email.com' };
|
||||
|
||||
setupTestBed({
|
||||
imports: [HttpClientTestingModule, ApolloModule],
|
||||
providers: [
|
||||
{ provide: TASK_FILTERS_SERVICE_TOKEN, useClass: LocalPreferenceCloudService }
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [HttpClientTestingModule, ApolloModule],
|
||||
providers: [
|
||||
{ provide: TASK_FILTERS_SERVICE_TOKEN, useClass: LocalPreferenceCloudService }
|
||||
]
|
||||
});
|
||||
service = TestBed.inject(TaskFilterCloudService);
|
||||
preferenceCloudService = service.preferenceService;
|
||||
identityUserService = TestBed.inject(IdentityUserService);
|
||||
|
||||
+7
-8
@@ -19,7 +19,7 @@ import { DebugElement, SimpleChange } from '@angular/core';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { of } from 'rxjs';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { FormModel, FormOutcomeEvent, FormOutcomeModel, setupTestBed } from '@alfresco/adf-core';
|
||||
import { FormModel, FormOutcomeEvent, FormOutcomeModel } from '@alfresco/adf-core';
|
||||
import { ProcessServiceCloudTestingModule } from '../../../testing/process-service-cloud.testing.module';
|
||||
import { TaskFormCloudComponent } from './task-form-cloud.component';
|
||||
import {
|
||||
@@ -61,14 +61,13 @@ describe('TaskFormCloudComponent', () => {
|
||||
let component: TaskFormCloudComponent;
|
||||
let fixture: ComponentFixture<TaskFormCloudComponent>;
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
]
|
||||
});
|
||||
taskDetails.status = TASK_ASSIGNED_STATE;
|
||||
taskDetails.permissions = [TASK_VIEW_PERMISSION];
|
||||
taskDetails.standalone = false;
|
||||
|
||||
+30
-30
@@ -18,8 +18,8 @@
|
||||
import { TaskHeaderCloudComponent } from './task-header-cloud.component';
|
||||
import { of, throwError } from 'rxjs';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { ComponentFixture, TestBed, fakeAsync } from '@angular/core/testing';
|
||||
import { setupTestBed, AppConfigService, AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { ComponentFixture, TestBed, fakeAsync, flush, discardPeriodicTasks } from '@angular/core/testing';
|
||||
import { AppConfigService, AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { ProcessServiceCloudTestingModule } from '../../../testing/process-service-cloud.testing.module';
|
||||
import { TaskCloudService } from '../../services/task-cloud.service';
|
||||
import { TaskHeaderCloudModule } from '../task-header-cloud.module';
|
||||
@@ -56,16 +56,15 @@ describe('TaskHeaderCloudComponent', () => {
|
||||
reply: jasmine.createSpy('reply')
|
||||
};
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule,
|
||||
TaskHeaderCloudModule,
|
||||
MatSelectModule
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule,
|
||||
TaskHeaderCloudModule,
|
||||
MatSelectModule
|
||||
]
|
||||
});
|
||||
appConfigService = TestBed.inject(AppConfigService);
|
||||
appConfigService.config = {
|
||||
'adf-cloud-task-header': {
|
||||
@@ -112,7 +111,6 @@ describe('TaskHeaderCloudComponent', () => {
|
||||
await fixture.whenStable();
|
||||
expect(getTaskByIdSpy).toHaveBeenCalled();
|
||||
expect(component.taskDetails).toBe(assignedTaskDetailsCloudMock);
|
||||
|
||||
});
|
||||
|
||||
it('should display assignee', async () => {
|
||||
@@ -214,6 +212,8 @@ describe('TaskHeaderCloudComponent', () => {
|
||||
expect(description.nativeElement.value.trim()).toEqual('This is the description');
|
||||
expect(taskCloudService.updateTask).toHaveBeenCalled();
|
||||
});
|
||||
flush();
|
||||
discardPeriodicTasks();
|
||||
}));
|
||||
|
||||
it('should show spinner before loading task details', () => {
|
||||
@@ -229,9 +229,9 @@ describe('TaskHeaderCloudComponent', () => {
|
||||
const priorityEditIcon = fixture.debugElement.query(By.css(`[data-automation-id="card-textitem-edit-icon-priority"]`));
|
||||
const descriptionEditIcon = fixture.debugElement.query(By.css(`[data-automation-id="card-textitem-edit-icon-description"]`));
|
||||
const dueDateEditIcon = fixture.debugElement.query(By.css(`[data-automation-id="datepickertoggle-dueDate"]`));
|
||||
expect(priorityEditIcon).toBeNull('Edit icon should NOT be shown');
|
||||
expect(descriptionEditIcon).toBeNull('Edit icon should NOT be shown');
|
||||
expect(dueDateEditIcon).toBeNull('Edit icon should NOT be shown');
|
||||
expect(priorityEditIcon).toBeNull();
|
||||
expect(descriptionEditIcon).toBeNull();
|
||||
expect(dueDateEditIcon).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -242,7 +242,7 @@ describe('TaskHeaderCloudComponent', () => {
|
||||
component.ngOnChanges();
|
||||
});
|
||||
|
||||
it('should fectch parent task details if the task has parent id', async () => {
|
||||
it('should fetch parent task details if the task has parent id', async () => {
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
expect(getTaskByIdSpy).toHaveBeenCalledTimes(2);
|
||||
@@ -330,8 +330,8 @@ describe('TaskHeaderCloudComponent', () => {
|
||||
fixture.detectChanges();
|
||||
const descriptionEditIcon = fixture.debugElement.query(By.css(`[data-automation-id="header-description"] [class*="adf-textitem-edit-icon"]`));
|
||||
const dueDateEditIcon = fixture.debugElement.query(By.css(`[data-automation-id="datepickertoggle-dueDate"]`));
|
||||
expect(descriptionEditIcon).not.toBeNull('Description edit icon should be shown');
|
||||
expect(dueDateEditIcon).not.toBeNull('Due date edit icon should be shown');
|
||||
expect(descriptionEditIcon).not.toBeNull();
|
||||
expect(dueDateEditIcon).not.toBeNull();
|
||||
});
|
||||
|
||||
it('should not render defined clickable edit icon for assignee property if the task in assigned state and assingned user is different from current logged-in user', () => {
|
||||
@@ -339,7 +339,7 @@ describe('TaskHeaderCloudComponent', () => {
|
||||
fixture.detectChanges();
|
||||
|
||||
const value = fixture.debugElement.query(By.css(`[data-automation-id="card-textitem-clickable-icon-assignee"]`));
|
||||
expect(value).toBeNull('Edit icon should NOT be shown');
|
||||
expect(value).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -370,7 +370,7 @@ describe('TaskHeaderCloudComponent', () => {
|
||||
it('should not render defined clickable edit icon for assignee property if the task in created state and not assigned', () => {
|
||||
fixture.detectChanges();
|
||||
const value = fixture.debugElement.query(By.css(`[data-automation-id="card-textitem-clickable-icon-assignee"]`));
|
||||
expect(value).toBeNull('Edit icon should NOT be shown');
|
||||
expect(value).toBeNull();
|
||||
});
|
||||
|
||||
it('should not render edit icon if the task in created state and not assigned', () => {
|
||||
@@ -378,9 +378,9 @@ describe('TaskHeaderCloudComponent', () => {
|
||||
const priorityEditIcon = fixture.debugElement.query(By.css(`[data-automation-id="card-textitem-edit-icon-priority"]`));
|
||||
const descriptionEditIcon = fixture.debugElement.query(By.css(`[data-automation-id="card-textitem-edit-icon-description"]`));
|
||||
const dueDateEditIcon = fixture.debugElement.query(By.css(`[data-automation-id="datepickertoggle-dueDate"]`));
|
||||
expect(priorityEditIcon).toBeNull('Edit icon should NOT be shown');
|
||||
expect(descriptionEditIcon).toBeNull('Edit icon should NOT be shown');
|
||||
expect(dueDateEditIcon).toBeNull('Edit icon should NOT be shown');
|
||||
expect(priorityEditIcon).toBeNull();
|
||||
expect(descriptionEditIcon).toBeNull();
|
||||
expect(dueDateEditIcon).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -410,9 +410,9 @@ describe('TaskHeaderCloudComponent', () => {
|
||||
const priorityEditIcon = fixture.debugElement.query(By.css(`[data-automation-id="card-textitem-edit-icon-priority"]`));
|
||||
const descriptionEditIcon = fixture.debugElement.query(By.css(`[data-automation-id="card-textitem-edit-icon-description"]`));
|
||||
const dueDateEditIcon = fixture.debugElement.query(By.css(`[data-automation-id="datepickertoggle-dueDate"]`));
|
||||
expect(priorityEditIcon).toBeNull('Edit icon should NOT be shown');
|
||||
expect(descriptionEditIcon).toBeNull('Edit icon shouaaa`zld NOT be shown');
|
||||
expect(dueDateEditIcon).toBeNull('Edit icon should NOT be shown');
|
||||
expect(priorityEditIcon).toBeNull();
|
||||
expect(descriptionEditIcon).toBeNull();
|
||||
expect(dueDateEditIcon).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -434,7 +434,7 @@ describe('TaskHeaderCloudComponent', () => {
|
||||
it('should not render defined clickable edit icon for assignee property if the task in suspended state', () => {
|
||||
fixture.detectChanges();
|
||||
const value = fixture.debugElement.query(By.css(`[data-automation-id="card-textitem-clickable-icon-assignee"]`));
|
||||
expect(value).toBeNull('Edit icon should NOT be shown');
|
||||
expect(value).toBeNull();
|
||||
});
|
||||
|
||||
it('should not render edit icon if the task in suspended state', () => {
|
||||
@@ -442,9 +442,9 @@ describe('TaskHeaderCloudComponent', () => {
|
||||
const priorityEditIcon = fixture.debugElement.query(By.css(`[data-automation-id="card-textitem-edit-icon-priority"]`));
|
||||
const descriptionEditIcon = fixture.debugElement.query(By.css(`[data-automation-id="card-textitem-edit-icon-description"]`));
|
||||
const dueDateEditIcon = fixture.debugElement.query(By.css(`[data-automation-id="datepickertoggle-dueDate"]`));
|
||||
expect(priorityEditIcon).toBeNull('Edit icon should NOT be shown');
|
||||
expect(descriptionEditIcon).toBeNull('Edit icon should NOT be shown');
|
||||
expect(dueDateEditIcon).toBeNull('Edit icon should NOT be shown');
|
||||
expect(priorityEditIcon).toBeNull();
|
||||
expect(descriptionEditIcon).toBeNull();
|
||||
expect(dueDateEditIcon).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
+125
-123
@@ -18,7 +18,7 @@
|
||||
import { Component, SimpleChange, ViewChild } from '@angular/core';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { AppConfigService, setupTestBed, DataRowEvent, ObjectDataRow, User } from '@alfresco/adf-core';
|
||||
import { AppConfigService, DataRowEvent, ObjectDataRow } 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';
|
||||
@@ -40,10 +40,6 @@ import { ServiceTaskListCloudService } from '../services/service-task-list-cloud
|
||||
class CustomTaskListComponent {
|
||||
@ViewChild(ServiceTaskListCloudComponent)
|
||||
taskList: ServiceTaskListCloudComponent;
|
||||
|
||||
getFullName(person: User): string {
|
||||
return `${person.firstName} ${person.lastName}`;
|
||||
}
|
||||
}
|
||||
@Component({
|
||||
template: `
|
||||
@@ -76,17 +72,16 @@ describe('ServiceTaskListCloudComponent', () => {
|
||||
let appConfig: AppConfigService;
|
||||
let serviceTaskListCloudService: ServiceTaskListCloudService;
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
],
|
||||
declarations: [
|
||||
EmptyTemplateComponent
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
],
|
||||
declarations: [
|
||||
EmptyTemplateComponent
|
||||
]
|
||||
});
|
||||
appConfig = TestBed.inject(AppConfigService);
|
||||
serviceTaskListCloudService = TestBed.inject(ServiceTaskListCloudService);
|
||||
fixture = TestBed.createComponent(ServiceTaskListCloudComponent);
|
||||
@@ -224,7 +219,8 @@ describe('ServiceTaskListCloudComponent', () => {
|
||||
});
|
||||
|
||||
it('should call endpoint when a column visibility gets changed', () => {
|
||||
spyOn(serviceTaskListCloudService, 'getServiceTaskByRequest');
|
||||
const emptyList = { list: { entries: [] } };
|
||||
spyOn(serviceTaskListCloudService, 'getServiceTaskByRequest').and.returnValue(of(emptyList));
|
||||
component.ngAfterContentInit();
|
||||
spyOn(component, 'createDatatableSchema');
|
||||
component.appName = 'fake-app-name';
|
||||
@@ -351,14 +347,17 @@ describe('ServiceTaskListCloudComponent', () => {
|
||||
component.updatePagination(pagination);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('Injecting custom colums for tasklist - CustomTaskListComponent', () => {
|
||||
let fixtureCustom: ComponentFixture<CustomTaskListComponent>;
|
||||
let componentCustom: CustomTaskListComponent;
|
||||
let customCopyComponent: CustomCopyContentTaskListComponent;
|
||||
let copyFixture: ComponentFixture<CustomCopyContentTaskListComponent>;
|
||||
describe('ServiceTaskListCloudComponent: Injecting custom columns for task list - CustomTaskListComponent', () => {
|
||||
let fixtureCustom: ComponentFixture<CustomTaskListComponent>;
|
||||
let componentCustom: CustomTaskListComponent;
|
||||
let customCopyComponent: CustomCopyContentTaskListComponent;
|
||||
let copyFixture: ComponentFixture<CustomCopyContentTaskListComponent>;
|
||||
let serviceTaskListCloudService: ServiceTaskListCloudService;
|
||||
|
||||
setupTestBed({
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
@@ -369,127 +368,130 @@ describe('ServiceTaskListCloudComponent', () => {
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
spyOn(serviceTaskListCloudService, 'getServiceTaskByRequest').and.returnValue(of(fakeServiceTask));
|
||||
fixtureCustom = TestBed.createComponent(CustomTaskListComponent);
|
||||
copyFixture = TestBed.createComponent(CustomCopyContentTaskListComponent);
|
||||
fixtureCustom.detectChanges();
|
||||
componentCustom = fixtureCustom.componentInstance;
|
||||
customCopyComponent = copyFixture.componentInstance;
|
||||
customCopyComponent.taskList.isColumnSchemaCreated$ = of(true);
|
||||
});
|
||||
serviceTaskListCloudService = TestBed.inject(ServiceTaskListCloudService);
|
||||
spyOn(serviceTaskListCloudService, 'getServiceTaskByRequest').and.returnValue(of(fakeServiceTask));
|
||||
|
||||
afterEach(() => {
|
||||
fixtureCustom.destroy();
|
||||
copyFixture.destroy();
|
||||
});
|
||||
|
||||
it('should fetch custom schemaColumn from html', () => {
|
||||
fixture.detectChanges();
|
||||
expect(componentCustom.taskList.columnList).toBeDefined();
|
||||
expect(componentCustom.taskList.columns[0]['title']).toEqual('ADF_CLOUD_TASK_LIST.PROPERTIES.NAME');
|
||||
expect(componentCustom.taskList.columns[1]['title']).toEqual('ADF_CLOUD_TASK_LIST.PROPERTIES.CREATED');
|
||||
expect(componentCustom.taskList.columns.length).toEqual(2);
|
||||
});
|
||||
|
||||
it('it should show copy tooltip when key is present in data-column', () => {
|
||||
customCopyComponent.taskList.reload();
|
||||
copyFixture.detectChanges();
|
||||
|
||||
copyFixture.debugElement
|
||||
.query(By.css('span[title="04fdf69f-4ddd-48ab-9563-da776c9b163c"]'))
|
||||
.triggerEventHandler('mouseenter');
|
||||
|
||||
copyFixture.detectChanges();
|
||||
expect(copyFixture.debugElement.query(By.css('.adf-copy-tooltip'))).not.toBeNull();
|
||||
});
|
||||
|
||||
it('it should not show copy tooltip when key is not present in data-column', () => {
|
||||
customCopyComponent.taskList.reload();
|
||||
copyFixture.detectChanges();
|
||||
|
||||
copyFixture.debugElement
|
||||
.query(By.css('span[title="serviceTaskName"]'))
|
||||
.triggerEventHandler('mouseenter');
|
||||
|
||||
copyFixture.detectChanges();
|
||||
expect(copyFixture.debugElement.query(By.css('.adf-copy-tooltip'))).toBeNull();
|
||||
});
|
||||
fixtureCustom = TestBed.createComponent(CustomTaskListComponent);
|
||||
copyFixture = TestBed.createComponent(CustomCopyContentTaskListComponent);
|
||||
fixtureCustom.detectChanges();
|
||||
componentCustom = fixtureCustom.componentInstance;
|
||||
customCopyComponent = copyFixture.componentInstance;
|
||||
customCopyComponent.taskList.isColumnSchemaCreated$ = of(true);
|
||||
});
|
||||
|
||||
describe('Copy cell content directive from app.config specifications', () => {
|
||||
let taskSpy: jasmine.Spy;
|
||||
afterEach(() => {
|
||||
fixtureCustom.destroy();
|
||||
copyFixture.destroy();
|
||||
});
|
||||
|
||||
setupTestBed({
|
||||
it('should fetch custom schemaColumn from html', () => {
|
||||
fixtureCustom.detectChanges();
|
||||
expect(componentCustom.taskList.columnList).toBeDefined();
|
||||
expect(componentCustom.taskList.columns[0]['title']).toEqual('ADF_CLOUD_TASK_LIST.PROPERTIES.NAME');
|
||||
expect(componentCustom.taskList.columns[1]['title']).toEqual('ADF_CLOUD_TASK_LIST.PROPERTIES.CREATED');
|
||||
expect(componentCustom.taskList.columns.length).toEqual(2);
|
||||
});
|
||||
|
||||
it('it should show copy tooltip when key is present in data-column', () => {
|
||||
customCopyComponent.taskList.reload();
|
||||
copyFixture.detectChanges();
|
||||
|
||||
copyFixture.debugElement
|
||||
.query(By.css('span[title="04fdf69f-4ddd-48ab-9563-da776c9b163c"]'))
|
||||
.triggerEventHandler('mouseenter');
|
||||
|
||||
copyFixture.detectChanges();
|
||||
expect(copyFixture.debugElement.query(By.css('.adf-copy-tooltip'))).not.toBeNull();
|
||||
});
|
||||
|
||||
it('it should not show copy tooltip when key is not present in data-column', () => {
|
||||
customCopyComponent.taskList.reload();
|
||||
copyFixture.detectChanges();
|
||||
|
||||
copyFixture.debugElement
|
||||
.query(By.css('span[title="serviceTaskName"]'))
|
||||
.triggerEventHandler('mouseenter');
|
||||
|
||||
copyFixture.detectChanges();
|
||||
expect(copyFixture.debugElement.query(By.css('.adf-copy-tooltip'))).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe('ServiceTaskListCloudComponent: Copy cell content directive from app.config specifications', () => {
|
||||
let taskSpy: jasmine.Spy;
|
||||
let appConfig: AppConfigService;
|
||||
let serviceTaskListCloudService: ServiceTaskListCloudService;
|
||||
let fixture: ComponentFixture<ServiceTaskListCloudComponent>;
|
||||
let component: ServiceTaskListCloudComponent;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
appConfig = TestBed.inject(AppConfigService);
|
||||
serviceTaskListCloudService = TestBed.inject(ServiceTaskListCloudService);
|
||||
appConfig.config = Object.assign(appConfig.config, {
|
||||
'adf-cloud-service-task-list': {
|
||||
presets: {
|
||||
fakeCustomSchema: [
|
||||
{
|
||||
key: 'id',
|
||||
type: 'text',
|
||||
title: 'ADF_CLOUD_TASK_LIST.PROPERTIES.FAKE',
|
||||
sortable: true,
|
||||
copyContent: true
|
||||
},
|
||||
{
|
||||
key: 'activityName',
|
||||
type: 'text',
|
||||
title: 'ADF_CLOUD_TASK_LIST.PROPERTIES.TASK_FAKE',
|
||||
sortable: true
|
||||
}
|
||||
]
|
||||
}
|
||||
appConfig = TestBed.inject(AppConfigService);
|
||||
serviceTaskListCloudService = TestBed.inject(ServiceTaskListCloudService);
|
||||
appConfig.config = Object.assign(appConfig.config, {
|
||||
'adf-cloud-service-task-list': {
|
||||
presets: {
|
||||
fakeCustomSchema: [
|
||||
{
|
||||
key: 'id',
|
||||
type: 'text',
|
||||
title: 'ADF_CLOUD_TASK_LIST.PROPERTIES.FAKE',
|
||||
sortable: true,
|
||||
copyContent: true
|
||||
},
|
||||
{
|
||||
key: 'activityName',
|
||||
type: 'text',
|
||||
title: 'ADF_CLOUD_TASK_LIST.PROPERTIES.TASK_FAKE',
|
||||
sortable: true
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
fixture = TestBed.createComponent(ServiceTaskListCloudComponent);
|
||||
component = fixture.componentInstance;
|
||||
taskSpy = spyOn(serviceTaskListCloudService, 'getServiceTaskByRequest').and.returnValue(of(fakeServiceTask));
|
||||
|
||||
});
|
||||
afterEach(() => {
|
||||
fixture.destroy();
|
||||
}
|
||||
});
|
||||
fixture = TestBed.createComponent(ServiceTaskListCloudComponent);
|
||||
component = fixture.componentInstance;
|
||||
taskSpy = spyOn(serviceTaskListCloudService, 'getServiceTaskByRequest').and.returnValue(of(fakeServiceTask));
|
||||
|
||||
it('shoud show tooltip if config copyContent flag is true', () => {
|
||||
taskSpy.and.returnValue(of(fakeServiceTask));
|
||||
component.presetColumn = 'fakeCustomSchema';
|
||||
});
|
||||
afterEach(() => {
|
||||
fixture.destroy();
|
||||
});
|
||||
|
||||
component.reload();
|
||||
fixture.detectChanges();
|
||||
it('shoud show tooltip if config copyContent flag is true', () => {
|
||||
taskSpy.and.returnValue(of(fakeServiceTask));
|
||||
component.presetColumn = 'fakeCustomSchema';
|
||||
|
||||
const columnWithCopyContentFlagTrue = fixture.debugElement
|
||||
.query(By.css('span[title="04fdf69f-4ddd-48ab-9563-da776c9b163c"]'));
|
||||
component.reload();
|
||||
fixture.detectChanges();
|
||||
|
||||
columnWithCopyContentFlagTrue.triggerEventHandler('mouseenter');
|
||||
const columnWithCopyContentFlagTrue = fixture.debugElement
|
||||
.query(By.css('span[title="04fdf69f-4ddd-48ab-9563-da776c9b163c"]'));
|
||||
|
||||
fixture.detectChanges();
|
||||
expect(fixture.debugElement.nativeElement.querySelector('.adf-copy-tooltip')).not.toBeNull();
|
||||
});
|
||||
columnWithCopyContentFlagTrue.triggerEventHandler('mouseenter');
|
||||
|
||||
it('shoud not show tooltip if config copyContent flag is NOT true', () => {
|
||||
taskSpy.and.returnValue(of(fakeServiceTask));
|
||||
component.presetColumn = 'fakeCustomSchema';
|
||||
fixture.detectChanges();
|
||||
expect(fixture.debugElement.nativeElement.querySelector('.adf-copy-tooltip')).not.toBeNull();
|
||||
});
|
||||
|
||||
component.reload();
|
||||
fixture.detectChanges();
|
||||
it('shoud not show tooltip if config copyContent flag is NOT true', () => {
|
||||
taskSpy.and.returnValue(of(fakeServiceTask));
|
||||
component.presetColumn = 'fakeCustomSchema';
|
||||
|
||||
const columnWithCopyContentFlagNotTrue = fixture.debugElement
|
||||
.query(By.css('span[title="serviceTaskName"]'));
|
||||
component.reload();
|
||||
fixture.detectChanges();
|
||||
|
||||
columnWithCopyContentFlagNotTrue.triggerEventHandler('mouseenter');
|
||||
const columnWithCopyContentFlagNotTrue = fixture.debugElement
|
||||
.query(By.css('span[title="serviceTaskName"]'));
|
||||
|
||||
fixture.detectChanges();
|
||||
expect(fixture.debugElement.nativeElement.querySelector('.adf-copy-tooltip')).toBeNull();
|
||||
});
|
||||
columnWithCopyContentFlagNotTrue.triggerEventHandler('mouseenter');
|
||||
|
||||
fixture.detectChanges();
|
||||
expect(fixture.debugElement.nativeElement.querySelector('.adf-copy-tooltip')).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
+194
-190
@@ -19,7 +19,6 @@ import { Component, SimpleChange, ViewChild } from '@angular/core';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { AppConfigService,
|
||||
setupTestBed,
|
||||
DataRowEvent,
|
||||
ObjectDataRow,
|
||||
User,
|
||||
@@ -102,24 +101,23 @@ describe('TaskListCloudComponent', () => {
|
||||
updatePreference: of({})
|
||||
});
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
],
|
||||
providers: [
|
||||
{
|
||||
provide: TASK_LIST_CLOUD_TOKEN,
|
||||
useClass: TaskListCloudService
|
||||
},
|
||||
{
|
||||
provide: TASK_LIST_PREFERENCES_SERVICE_TOKEN,
|
||||
useValue: preferencesService
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
],
|
||||
providers: [
|
||||
{
|
||||
provide: TASK_LIST_CLOUD_TOKEN,
|
||||
useClass: TaskListCloudService
|
||||
},
|
||||
{
|
||||
provide: TASK_LIST_PREFERENCES_SERVICE_TOKEN,
|
||||
useValue: preferencesService
|
||||
}
|
||||
]
|
||||
});
|
||||
appConfig = TestBed.inject(AppConfigService);
|
||||
fixture = TestBed.createComponent(TaskListCloudComponent);
|
||||
component = fixture.componentInstance;
|
||||
@@ -497,14 +495,17 @@ describe('TaskListCloudComponent', () => {
|
||||
component.updatePagination(pagination);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('Injecting custom colums for tasklist - CustomTaskListComponent', () => {
|
||||
let fixtureCustom: ComponentFixture<CustomTaskListComponent>;
|
||||
let componentCustom: CustomTaskListComponent;
|
||||
let customCopyComponent: CustomCopyContentTaskListComponent;
|
||||
let copyFixture: ComponentFixture<CustomCopyContentTaskListComponent>;
|
||||
describe('TaskListCloudComponent: Injecting custom colums for tasklist - CustomTaskListComponent', () => {
|
||||
let fixtureCustom: ComponentFixture<CustomTaskListComponent>;
|
||||
let componentCustom: CustomTaskListComponent;
|
||||
let customCopyComponent: CustomCopyContentTaskListComponent;
|
||||
let copyFixture: ComponentFixture<CustomCopyContentTaskListComponent>;
|
||||
let taskListCloudService: TaskListCloudServiceInterface;
|
||||
|
||||
setupTestBed({
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
@@ -514,59 +515,60 @@ describe('TaskListCloudComponent', () => {
|
||||
CustomCopyContentTaskListComponent
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
spyOn(taskListCloudService, 'getTaskByRequest').and.returnValue(of(fakeGlobalTasks));
|
||||
fixtureCustom = TestBed.createComponent(CustomTaskListComponent);
|
||||
copyFixture = TestBed.createComponent(CustomCopyContentTaskListComponent);
|
||||
fixtureCustom.detectChanges();
|
||||
componentCustom = fixtureCustom.componentInstance;
|
||||
customCopyComponent = copyFixture.componentInstance;
|
||||
customCopyComponent.taskList.isColumnSchemaCreated$ = of(true);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
fixtureCustom.destroy();
|
||||
copyFixture.destroy();
|
||||
});
|
||||
|
||||
it('should fetch custom schemaColumn from html', () => {
|
||||
copyFixture.detectChanges();
|
||||
expect(componentCustom.taskList.columnList).toBeDefined();
|
||||
expect(componentCustom.taskList.columns[0]['title']).toEqual('ADF_CLOUD_TASK_LIST.PROPERTIES.NAME');
|
||||
expect(componentCustom.taskList.columns[1]['title']).toEqual('ADF_CLOUD_TASK_LIST.PROPERTIES.CREATED');
|
||||
expect(componentCustom.taskList.columns.length).toEqual(3);
|
||||
});
|
||||
|
||||
it('it should show copy tooltip when key is present in data-column', () => {
|
||||
customCopyComponent.taskList.reload();
|
||||
copyFixture.detectChanges();
|
||||
|
||||
copyFixture.debugElement
|
||||
.query(By.css('span[title="11fe013d-c263-11e8-b75b-0a5864600540"]'))
|
||||
.triggerEventHandler('mouseenter');
|
||||
|
||||
copyFixture.detectChanges();
|
||||
expect(copyFixture.debugElement.query(By.css('.adf-copy-tooltip'))).not.toBeNull();
|
||||
});
|
||||
|
||||
it('it should not show copy tooltip when key is not present in data-column', () => {
|
||||
customCopyComponent.taskList.reload();
|
||||
copyFixture.detectChanges();
|
||||
|
||||
copyFixture.debugElement
|
||||
.query(By.css('span[title="standalone-subtask"]'))
|
||||
.triggerEventHandler('mouseenter');
|
||||
|
||||
copyFixture.detectChanges();
|
||||
expect(copyFixture.debugElement.query(By.css('.adf-copy-tooltip'))).toBeNull();
|
||||
});
|
||||
taskListCloudService = TestBed.inject(TASK_LIST_CLOUD_TOKEN);
|
||||
spyOn(taskListCloudService, 'getTaskByRequest').and.returnValue(of(fakeGlobalTasks));
|
||||
fixtureCustom = TestBed.createComponent(CustomTaskListComponent);
|
||||
copyFixture = TestBed.createComponent(CustomCopyContentTaskListComponent);
|
||||
fixtureCustom.detectChanges();
|
||||
componentCustom = fixtureCustom.componentInstance;
|
||||
customCopyComponent = copyFixture.componentInstance;
|
||||
customCopyComponent.taskList.isColumnSchemaCreated$ = of(true);
|
||||
});
|
||||
|
||||
describe('Creating an empty custom template - EmptyTemplateComponent', () => {
|
||||
let fixtureEmpty: ComponentFixture<EmptyTemplateComponent>;
|
||||
afterEach(() => {
|
||||
fixtureCustom.destroy();
|
||||
copyFixture.destroy();
|
||||
});
|
||||
|
||||
setupTestBed({
|
||||
it('should fetch custom schemaColumn from html', () => {
|
||||
copyFixture.detectChanges();
|
||||
expect(componentCustom.taskList.columnList).toBeDefined();
|
||||
expect(componentCustom.taskList.columns[0]['title']).toEqual('ADF_CLOUD_TASK_LIST.PROPERTIES.NAME');
|
||||
expect(componentCustom.taskList.columns[1]['title']).toEqual('ADF_CLOUD_TASK_LIST.PROPERTIES.CREATED');
|
||||
expect(componentCustom.taskList.columns.length).toEqual(3);
|
||||
});
|
||||
|
||||
it('it should show copy tooltip when key is present in data-column', () => {
|
||||
customCopyComponent.taskList.reload();
|
||||
copyFixture.detectChanges();
|
||||
|
||||
copyFixture.debugElement
|
||||
.query(By.css('span[title="11fe013d-c263-11e8-b75b-0a5864600540"]'))
|
||||
.triggerEventHandler('mouseenter');
|
||||
|
||||
copyFixture.detectChanges();
|
||||
expect(copyFixture.debugElement.query(By.css('.adf-copy-tooltip'))).not.toBeNull();
|
||||
});
|
||||
|
||||
it('it should not show copy tooltip when key is not present in data-column', () => {
|
||||
customCopyComponent.taskList.reload();
|
||||
copyFixture.detectChanges();
|
||||
|
||||
copyFixture.debugElement
|
||||
.query(By.css('span[title="standalone-subtask"]'))
|
||||
.triggerEventHandler('mouseenter');
|
||||
|
||||
copyFixture.detectChanges();
|
||||
expect(copyFixture.debugElement.query(By.css('.adf-copy-tooltip'))).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe('TaskListCloudComponent: Creating an empty custom template - EmptyTemplateComponent', () => {
|
||||
let fixtureEmpty: ComponentFixture<EmptyTemplateComponent>;
|
||||
let taskListCloudService: TaskListCloudServiceInterface;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
HttpClientModule,
|
||||
NoopAnimationsModule,
|
||||
@@ -579,147 +581,149 @@ describe('TaskListCloudComponent', () => {
|
||||
{ provide: TranslationService, useClass: TranslationMock }
|
||||
]
|
||||
});
|
||||
taskListCloudService = TestBed.inject(TASK_LIST_CLOUD_TOKEN);
|
||||
const emptyList = { list: { entries: [] } };
|
||||
spyOn(taskListCloudService, 'getTaskByRequest').and.returnValue(of(emptyList));
|
||||
|
||||
beforeEach(() => {
|
||||
const emptyList = { list: { entries: [] } };
|
||||
spyOn(taskListCloudService, 'getTaskByRequest').and.returnValue(of(emptyList));
|
||||
|
||||
fixtureEmpty = TestBed.createComponent(EmptyTemplateComponent);
|
||||
fixtureEmpty.detectChanges();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
fixtureEmpty.destroy();
|
||||
});
|
||||
|
||||
it('should render the custom template', async () => {
|
||||
fixtureEmpty.detectChanges();
|
||||
await fixtureEmpty.whenStable();
|
||||
fixtureEmpty.detectChanges();
|
||||
expect(fixtureEmpty.debugElement.query(By.css('#custom-id'))).not.toBeNull();
|
||||
expect(fixtureEmpty.debugElement.query(By.css('.adf-empty-content'))).toBeNull();
|
||||
});
|
||||
fixtureEmpty = TestBed.createComponent(EmptyTemplateComponent);
|
||||
fixtureEmpty.detectChanges();
|
||||
});
|
||||
|
||||
describe('Copy cell content directive from app.config specifications', () => {
|
||||
let taskSpy: jasmine.Spy;
|
||||
afterEach(() => {
|
||||
fixtureEmpty.destroy();
|
||||
});
|
||||
|
||||
setupTestBed({
|
||||
it('should render the custom template', async () => {
|
||||
fixtureEmpty.detectChanges();
|
||||
await fixtureEmpty.whenStable();
|
||||
fixtureEmpty.detectChanges();
|
||||
expect(fixtureEmpty.debugElement.query(By.css('#custom-id'))).not.toBeNull();
|
||||
expect(fixtureEmpty.debugElement.query(By.css('.adf-empty-content'))).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
describe('TaskListCloudComponent: Copy cell content directive from app.config specifications', () => {
|
||||
let taskSpy: jasmine.Spy;
|
||||
let appConfig: AppConfigService;
|
||||
let taskListCloudService: TaskListCloudServiceInterface;
|
||||
let component: TaskListCloudComponent;
|
||||
let fixture: ComponentFixture<TaskListCloudComponent>;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
appConfig = TestBed.inject(AppConfigService);
|
||||
taskListCloudService = TestBed.inject(TASK_LIST_CLOUD_TOKEN);
|
||||
appConfig.config = Object.assign(appConfig.config, {
|
||||
'adf-cloud-task-list': {
|
||||
presets: {
|
||||
fakeCustomSchema: [
|
||||
{
|
||||
key: 'id',
|
||||
type: 'text',
|
||||
title: 'ADF_CLOUD_TASK_LIST.PROPERTIES.FAKE',
|
||||
sortable: true,
|
||||
copyContent: true
|
||||
},
|
||||
{
|
||||
key: 'name',
|
||||
type: 'text',
|
||||
title: 'ADF_CLOUD_TASK_LIST.PROPERTIES.TASK_FAKE',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
key: 'priority',
|
||||
type: 'text',
|
||||
title: 'ADF_TASK_LIST.PROPERTIES.PRIORITY',
|
||||
sortable: true
|
||||
}
|
||||
]
|
||||
}
|
||||
appConfig = TestBed.inject(AppConfigService);
|
||||
taskListCloudService = TestBed.inject(TASK_LIST_CLOUD_TOKEN);
|
||||
appConfig.config = Object.assign(appConfig.config, {
|
||||
'adf-cloud-task-list': {
|
||||
presets: {
|
||||
fakeCustomSchema: [
|
||||
{
|
||||
key: 'id',
|
||||
type: 'text',
|
||||
title: 'ADF_CLOUD_TASK_LIST.PROPERTIES.FAKE',
|
||||
sortable: true,
|
||||
copyContent: true
|
||||
},
|
||||
{
|
||||
key: 'name',
|
||||
type: 'text',
|
||||
title: 'ADF_CLOUD_TASK_LIST.PROPERTIES.TASK_FAKE',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
key: 'priority',
|
||||
type: 'text',
|
||||
title: 'ADF_TASK_LIST.PROPERTIES.PRIORITY',
|
||||
sortable: true
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
fixture = TestBed.createComponent(TaskListCloudComponent);
|
||||
component = fixture.componentInstance;
|
||||
taskSpy = spyOn(taskListCloudService, 'getTaskByRequest').and.returnValue(of(fakeGlobalTasks));
|
||||
component.isColumnSchemaCreated$ = of(true);
|
||||
}
|
||||
});
|
||||
fixture = TestBed.createComponent(TaskListCloudComponent);
|
||||
component = fixture.componentInstance;
|
||||
taskSpy = spyOn(taskListCloudService, 'getTaskByRequest').and.returnValue(of(fakeGlobalTasks));
|
||||
component.isColumnSchemaCreated$ = of(true);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
fixture.destroy();
|
||||
});
|
||||
afterEach(() => {
|
||||
fixture.destroy();
|
||||
});
|
||||
|
||||
it('should show tooltip if config copyContent flag is true', () => {
|
||||
taskSpy.and.returnValue(of(fakeGlobalTasks));
|
||||
component.presetColumn = 'fakeCustomSchema';
|
||||
it('should show tooltip if config copyContent flag is true', () => {
|
||||
taskSpy.and.returnValue(of(fakeGlobalTasks));
|
||||
component.presetColumn = 'fakeCustomSchema';
|
||||
|
||||
component.reload();
|
||||
fixture.detectChanges();
|
||||
component.reload();
|
||||
fixture.detectChanges();
|
||||
|
||||
const columnWithCopyContentFlagTrue = fixture.debugElement
|
||||
.query(By.css('span[title="11fe013d-c263-11e8-b75b-0a5864600540"]'));
|
||||
const columnWithCopyContentFlagTrue = fixture.debugElement
|
||||
.query(By.css('span[title="11fe013d-c263-11e8-b75b-0a5864600540"]'));
|
||||
|
||||
columnWithCopyContentFlagTrue.triggerEventHandler('mouseenter');
|
||||
columnWithCopyContentFlagTrue.triggerEventHandler('mouseenter');
|
||||
|
||||
fixture.detectChanges();
|
||||
expect(fixture.debugElement.nativeElement.querySelector('.adf-copy-tooltip')).not.toBeNull();
|
||||
});
|
||||
fixture.detectChanges();
|
||||
expect(fixture.debugElement.nativeElement.querySelector('.adf-copy-tooltip')).not.toBeNull();
|
||||
});
|
||||
|
||||
it('should replace priority values', () => {
|
||||
taskSpy.and.returnValue(of(fakeGlobalTasks));
|
||||
component.presetColumn = 'fakeCustomSchema';
|
||||
it('should replace priority values', () => {
|
||||
taskSpy.and.returnValue(of(fakeGlobalTasks));
|
||||
component.presetColumn = 'fakeCustomSchema';
|
||||
|
||||
component.reload();
|
||||
fixture.detectChanges();
|
||||
component.reload();
|
||||
fixture.detectChanges();
|
||||
|
||||
const cell = fixture.debugElement
|
||||
.query(By.css('[data-automation-id="text_ADF_CLOUD_TASK_LIST.PROPERTIES.PRIORITY_VALUES.NONE"]'));
|
||||
expect(cell.nativeElement.textContent).toEqual('ADF_CLOUD_TASK_LIST.PROPERTIES.PRIORITY_VALUES.NONE');
|
||||
});
|
||||
const cell = fixture.debugElement
|
||||
.query(By.css('[data-automation-id="text_ADF_CLOUD_TASK_LIST.PROPERTIES.PRIORITY_VALUES.NONE"]'));
|
||||
expect(cell.nativeElement.textContent).toEqual('ADF_CLOUD_TASK_LIST.PROPERTIES.PRIORITY_VALUES.NONE');
|
||||
});
|
||||
|
||||
it('replacePriorityValues should return undefined when no rows defined', () => {
|
||||
const emptyList = { list: { entries: [] } };
|
||||
taskSpy.and.returnValue(of(emptyList));
|
||||
fixture.detectChanges();
|
||||
it('replacePriorityValues should return undefined when no rows defined', () => {
|
||||
const emptyList = { list: { entries: [] } };
|
||||
taskSpy.and.returnValue(of(emptyList));
|
||||
fixture.detectChanges();
|
||||
|
||||
const appName = new SimpleChange(null, 'FAKE-APP-NAME', true);
|
||||
component.ngOnChanges({ appName });
|
||||
fixture.detectChanges();
|
||||
const appName = new SimpleChange(null, 'FAKE-APP-NAME', true);
|
||||
component.ngOnChanges({ appName });
|
||||
fixture.detectChanges();
|
||||
|
||||
const emptyContent = fixture.debugElement.query(By.css('.adf-empty-content'));
|
||||
expect(emptyContent.nativeElement).toBeDefined();
|
||||
expect(component.replacePriorityValues({
|
||||
obj: {},
|
||||
isSelected: false,
|
||||
hasValue: () => false,
|
||||
getValue: () => undefined
|
||||
}, {
|
||||
type: 'text',
|
||||
key: 'priority'
|
||||
})).toEqual(undefined);
|
||||
});
|
||||
const emptyContent = fixture.debugElement.query(By.css('.adf-empty-content'));
|
||||
expect(emptyContent.nativeElement).toBeDefined();
|
||||
expect(component.replacePriorityValues({
|
||||
obj: {},
|
||||
isSelected: false,
|
||||
hasValue: () => false,
|
||||
getValue: () => undefined
|
||||
}, {
|
||||
type: 'text',
|
||||
key: 'priority'
|
||||
})).toEqual(undefined);
|
||||
});
|
||||
|
||||
it('replacePriorityValues should return replaced value when rows are defined', () => {
|
||||
taskSpy.and.returnValue(of(fakeGlobalTasks));
|
||||
fixture.detectChanges();
|
||||
it('replacePriorityValues should return replaced value when rows are defined', () => {
|
||||
taskSpy.and.returnValue(of(fakeGlobalTasks));
|
||||
fixture.detectChanges();
|
||||
|
||||
const appName = new SimpleChange(null, 'FAKE-APP-NAME', true);
|
||||
component.ngOnChanges({ appName });
|
||||
fixture.detectChanges();
|
||||
const appName = new SimpleChange(null, 'FAKE-APP-NAME', true);
|
||||
component.ngOnChanges({ appName });
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(component.replacePriorityValues({
|
||||
obj: {
|
||||
priority: 1
|
||||
},
|
||||
isSelected: false,
|
||||
hasValue: () => false,
|
||||
getValue: () => undefined
|
||||
}, {
|
||||
type: 'text',
|
||||
key: 'priority'
|
||||
})).toEqual('ADF_CLOUD_TASK_LIST.PROPERTIES.PRIORITY_VALUES.LOW');
|
||||
});
|
||||
expect(component.replacePriorityValues({
|
||||
obj: {
|
||||
priority: 1
|
||||
},
|
||||
isSelected: false,
|
||||
hasValue: () => false,
|
||||
getValue: () => undefined
|
||||
}, {
|
||||
type: 'text',
|
||||
key: 'priority'
|
||||
})).toEqual('ADF_CLOUD_TASK_LIST.PROPERTIES.PRIORITY_VALUES.LOW');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
+6
-7
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { setupTestBed, LogService } from '@alfresco/adf-core';
|
||||
import { LogService } from '@alfresco/adf-core';
|
||||
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';
|
||||
@@ -34,13 +34,12 @@ describe('Activiti ServiceTaskList Cloud Service', () => {
|
||||
|
||||
const returnCallUrl = (queryUrl) => Promise.resolve(queryUrl);
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
ProcessServiceCloudTestingModule
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
ProcessServiceCloudTestingModule
|
||||
]
|
||||
});
|
||||
adfHttpClient = TestBed.inject(AdfHttpClient);
|
||||
service = TestBed.inject(ServiceTaskListCloudService);
|
||||
logService = TestBed.inject(LogService);
|
||||
|
||||
+6
-8
@@ -16,7 +16,6 @@
|
||||
*/
|
||||
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { setupTestBed } from '@alfresco/adf-core';
|
||||
import { TaskListCloudService } from './task-list-cloud.service';
|
||||
import { TaskQueryCloudRequestModel } from '../../../models/filter-cloud-model';
|
||||
import { ProcessServiceCloudTestingModule } from '../../../testing/process-service-cloud.testing.module';
|
||||
@@ -33,14 +32,13 @@ describe('TaskListCloudService', () => {
|
||||
|
||||
const returnCallUrl = (queryUrl) => Promise.resolve(queryUrl);
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ProcessServiceCloudTestingModule
|
||||
]
|
||||
});
|
||||
adfHttpClient = TestBed.inject(AdfHttpClient);
|
||||
service = TestBed.inject(TaskListCloudService);
|
||||
requestSpy = spyOn(adfHttpClient, 'request');
|
||||
|
||||
@@ -31,7 +31,7 @@ declare const require: any;
|
||||
getTestBed().initTestEnvironment(
|
||||
BrowserDynamicTestingModule,
|
||||
platformBrowserDynamicTesting(), {
|
||||
teardown: { destroyAfterEach: false }
|
||||
teardown: { destroyAfterEach: true }
|
||||
}
|
||||
);
|
||||
// Then we find all the tests.
|
||||
|
||||
Reference in New Issue
Block a user