mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
Fixed process unit test after huge rebase
This commit is contained in:
@@ -17,9 +17,19 @@
|
||||
|
||||
import { FileViewerWidgetComponent } from './file-viewer.widget';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { FormModel, FormService, FormFieldModel } from '@alfresco/adf-core';
|
||||
import {
|
||||
FormModel,
|
||||
FormService,
|
||||
FormFieldModel,
|
||||
TranslationService,
|
||||
TranslationMock,
|
||||
AuthenticationService,
|
||||
RedirectAuthService
|
||||
} from '@alfresco/adf-core';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
import { EMPTY } from 'rxjs';
|
||||
|
||||
describe('FileViewerWidgetComponent', () => {
|
||||
const fakeForm = new FormModel();
|
||||
@@ -44,11 +54,13 @@ describe('FileViewerWidgetComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot()
|
||||
imports: [TranslateModule.forRoot(), FileViewerWidgetComponent, HttpClientTestingModule],
|
||||
providers: [
|
||||
{ provide: FormService, useValue: formServiceStub },
|
||||
{ provide: TranslationService, useClass: TranslationMock },
|
||||
AuthenticationService,
|
||||
{ provide: RedirectAuthService, useValue: { onLogin: EMPTY } }
|
||||
],
|
||||
declarations: [ FileViewerWidgetComponent ],
|
||||
providers: [ { provide: FormService, useValue: formServiceStub } ],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
});
|
||||
|
||||
|
@@ -63,9 +63,9 @@ describe('RadioButtonsWidgetComponent', () => {
|
||||
FormsModule,
|
||||
HttpClientTestingModule,
|
||||
MatIconModule,
|
||||
ErrorWidgetComponent
|
||||
ErrorWidgetComponent,
|
||||
RadioButtonsWidgetComponent
|
||||
],
|
||||
declarations: [RadioButtonsWidgetComponent],
|
||||
providers: [
|
||||
{ provide: TranslationService, useClass: TranslationMock },
|
||||
{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock },
|
||||
|
@@ -16,22 +16,27 @@
|
||||
*/
|
||||
|
||||
import { SimpleChange } from '@angular/core';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { AppConfigService, AppConfigServiceMock, LocalizedDatePipe, TemplateModule, TranslationMock, TranslationService } from '@alfresco/adf-core';
|
||||
import { AppsProcessService } from '../../app-list/services/apps-process.service';
|
||||
import { ComponentFixture, getTestBed } from '@angular/core/testing';
|
||||
import {
|
||||
AppConfigService,
|
||||
AppConfigServiceMock,
|
||||
FormRenderingService,
|
||||
LocalizedDatePipe,
|
||||
PipeModule,
|
||||
TemplateModule,
|
||||
TranslationMock,
|
||||
TranslationService
|
||||
} from '@alfresco/adf-core';
|
||||
import { of, throwError } from 'rxjs';
|
||||
import { MatSelectChange } from '@angular/material/select';
|
||||
import { MatSelectChange, MatSelectModule } from '@angular/material/select';
|
||||
import { ProcessService } from '../../services/process.service';
|
||||
import { newProcess, taskFormMock, testProcessDef, testMultipleProcessDefs, testProcessDefWithForm, testProcessDefinitions } from '../../../mock';
|
||||
import { StartProcessInstanceComponent } from './start-process.component';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { deployedApps } from '../../mock/apps-list.mock';
|
||||
import { ActivitiContentService } from '../../form/services/activiti-alfresco.service';
|
||||
import { HarnessLoader } from '@angular/cdk/testing';
|
||||
import { MatFormFieldHarness } from '@angular/material/form-field/testing';
|
||||
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
|
||||
import { MatAutocompleteHarness } from '@angular/material/autocomplete/testing';
|
||||
import { FormModule } from '../../form';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
import { HttpClientTestingModule } from '@angular/common/http/testing';
|
||||
@@ -39,6 +44,11 @@ import { MatInputModule } from '@angular/material/input';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
||||
import { RestVariable } from '@alfresco/js-api';
|
||||
import { ActivitiContentService } from '../../../form/services/activiti-alfresco.service';
|
||||
import { AppsProcessService } from '../../../services/apps-process.service';
|
||||
import { deployedApps } from '../../../mock/apps-list.mock';
|
||||
import { ProcessFormRenderingService } from '../../../form';
|
||||
import { FORM_FIELD_MODEL_RENDER_MIDDLEWARE } from 'lib/core/src/lib/form/components/middlewares/middleware';
|
||||
|
||||
describe('StartProcessComponent', () => {
|
||||
let appConfig: AppConfigService;
|
||||
@@ -55,11 +65,10 @@ describe('StartProcessComponent', () => {
|
||||
let getDeployedApplicationsSpy: jasmine.Spy;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
getTestBed().configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
TemplateModule,
|
||||
FormModule,
|
||||
NoopAnimationsModule,
|
||||
ReactiveFormsModule,
|
||||
FormsModule,
|
||||
@@ -67,16 +76,20 @@ describe('StartProcessComponent', () => {
|
||||
MatInputModule,
|
||||
MatIconModule,
|
||||
MatSelectModule,
|
||||
MatAutocompleteModule
|
||||
MatAutocompleteModule,
|
||||
PipeModule,
|
||||
StartProcessInstanceComponent
|
||||
],
|
||||
declarations: [StartProcessInstanceComponent],
|
||||
providers: [
|
||||
LocalizedDatePipe,
|
||||
ActivitiContentService,
|
||||
ProcessService,
|
||||
AppsProcessService,
|
||||
FormRenderingService,
|
||||
{ provide: FormRenderingService, useClass: ProcessFormRenderingService },
|
||||
{ provide: AppConfigService, useClass: AppConfigServiceMock },
|
||||
{ provide: TranslationService, useClass: TranslationMock }
|
||||
{ provide: TranslationService, useClass: TranslationMock },
|
||||
{ provide: FORM_FIELD_MODEL_RENDER_MIDDLEWARE, useValue: [] }
|
||||
]
|
||||
});
|
||||
});
|
||||
@@ -102,13 +115,13 @@ describe('StartProcessComponent', () => {
|
||||
}
|
||||
|
||||
beforeEach(() => {
|
||||
appConfig = TestBed.inject(AppConfigService);
|
||||
activitiContentService = TestBed.inject(ActivitiContentService);
|
||||
fixture = TestBed.createComponent(StartProcessInstanceComponent);
|
||||
appConfig = getTestBed().inject(AppConfigService);
|
||||
activitiContentService = getTestBed().inject(ActivitiContentService);
|
||||
fixture = getTestBed().createComponent(StartProcessInstanceComponent);
|
||||
component = fixture.componentInstance;
|
||||
loader = TestbedHarnessEnvironment.loader(fixture);
|
||||
processService = TestBed.inject(ProcessService);
|
||||
appsProcessService = TestBed.inject(AppsProcessService);
|
||||
processService = getTestBed().inject(ProcessService);
|
||||
appsProcessService = getTestBed().inject(AppsProcessService);
|
||||
|
||||
getDefinitionsSpy = spyOn(processService, 'getProcessDefinitions').and.returnValue(of(testMultipleProcessDefs));
|
||||
startProcessSpy = spyOn(processService, 'startProcess').and.returnValue(of(newProcess));
|
||||
|
@@ -29,10 +29,10 @@ import {
|
||||
AlfrescoApiServiceMock,
|
||||
AlfrescoApiService
|
||||
} from '@alfresco/adf-core';
|
||||
import { TaskListService } from '../services/tasklist.service';
|
||||
import { TaskListService } from '../../services/tasklist.service';
|
||||
import { TaskListComponent } from './task-list.component';
|
||||
import { ProcessTestingModule } from '../../testing/process.testing.module';
|
||||
import { fakeGlobalTask, fakeEmptyTask, paginatedTask, fakeColumnSchema, fakeCustomSchema } from '../../mock';
|
||||
import { ProcessTestingModule } from '../../../testing/process.testing.module';
|
||||
import { fakeGlobalTask, fakeEmptyTask, paginatedTask, fakeColumnSchema, fakeCustomSchema } from '../../../mock';
|
||||
import { TranslateService, TranslateModule } from '@ngx-translate/core';
|
||||
import { of, Subject } from 'rxjs';
|
||||
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
|
||||
@@ -106,8 +106,14 @@ describe('TaskListComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [TranslateModule.forRoot(), DataTableModule, NoopAnimationsModule, MatProgressSpinnerModule, HttpClientTestingModule, TaskListComponent],
|
||||
declarations: [TaskListComponent],
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
DataTableModule,
|
||||
NoopAnimationsModule,
|
||||
MatProgressSpinnerModule,
|
||||
HttpClientTestingModule,
|
||||
TaskListComponent
|
||||
],
|
||||
providers: [
|
||||
TaskListService,
|
||||
{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock },
|
||||
|
Reference in New Issue
Block a user