mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-09-17 14:21:29 +00:00
workarounds for jasmine.ajax in unit tests
This commit is contained in:
committed by
Anton Ramanovich
parent
4d84f665ce
commit
880c670593
@@ -19,6 +19,7 @@ import { SimpleChange } from '@angular/core';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { CreateProcessAttachmentComponent } from './create-process-attachment.component';
|
||||
import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services';
|
||||
import { AdfHttpClient } from '@alfresco/adf-core/api';
|
||||
|
||||
declare let jasmine: any;
|
||||
|
||||
@@ -48,7 +49,11 @@ describe('CreateProcessAttachmentComponent', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [CreateProcessAttachmentComponent],
|
||||
providers: [{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }]
|
||||
providers: [
|
||||
{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock },
|
||||
// TODO: remove this as soon as unit test not using jasmine.Ajax
|
||||
{ provide: AdfHttpClient, useValue: null }
|
||||
]
|
||||
});
|
||||
fixture = TestBed.createComponent(CreateProcessAttachmentComponent);
|
||||
component = fixture.componentInstance;
|
||||
|
@@ -20,6 +20,7 @@ import { FormModel } from '@alfresco/adf-core';
|
||||
import { EcmModelService } from './ecm-model.service';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services';
|
||||
import { AdfHttpClient } from '@alfresco/adf-core/api';
|
||||
|
||||
declare let jasmine: any;
|
||||
|
||||
@@ -29,7 +30,11 @@ describe('EcmModelService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [],
|
||||
providers: [{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }]
|
||||
providers: [
|
||||
{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock },
|
||||
// TODO: remove this as soon as unit test not using jasmine.Ajax
|
||||
{ provide: AdfHttpClient, useValue: null }
|
||||
]
|
||||
});
|
||||
service = TestBed.inject(EcmModelService);
|
||||
jasmine.Ajax.install();
|
||||
|
@@ -18,6 +18,7 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { ProcessContentService } from './process-content.service';
|
||||
import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services';
|
||||
import { AdfHttpClient } from '@alfresco/adf-core/api';
|
||||
|
||||
declare let jasmine: any;
|
||||
|
||||
@@ -66,7 +67,11 @@ describe('ProcessContentService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [],
|
||||
providers: [{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }]
|
||||
providers: [
|
||||
{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock },
|
||||
// TODO: remove this as soon as unit test not using jasmine.Ajax
|
||||
{ provide: AdfHttpClient, useValue: null }
|
||||
]
|
||||
});
|
||||
service = TestBed.inject(ProcessContentService);
|
||||
});
|
||||
|
@@ -23,6 +23,7 @@ import { of } from 'rxjs';
|
||||
import { ContentWidgetComponent } from './content.widget';
|
||||
import { ProcessContentService } from '../../services/process-content.service';
|
||||
import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services';
|
||||
import { AdfHttpClient } from '@alfresco/adf-core/api';
|
||||
|
||||
declare let jasmine: any;
|
||||
|
||||
@@ -61,7 +62,11 @@ describe('ContentWidgetComponent', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [ContentWidgetComponent],
|
||||
providers: [{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }]
|
||||
providers: [
|
||||
{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock },
|
||||
// TODO: remove this as soon as unit test not using jasmine.Ajax
|
||||
{ provide: AdfHttpClient, useValue: null }
|
||||
]
|
||||
});
|
||||
downloadService = TestBed.inject(DownloadService);
|
||||
processContentService = TestBed.inject(ProcessContentService);
|
||||
|
@@ -19,6 +19,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { of } from 'rxjs';
|
||||
import { PeopleSearchComponent } from './people-search.component';
|
||||
import { LightUserRepresentation } from '@alfresco/js-api';
|
||||
import { AdfHttpClient } from '@alfresco/adf-core/api';
|
||||
|
||||
const fakeUser: LightUserRepresentation = {
|
||||
id: 1,
|
||||
@@ -43,7 +44,11 @@ describe('PeopleSearchComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [PeopleSearchComponent]
|
||||
imports: [PeopleSearchComponent],
|
||||
providers: [
|
||||
// TODO: remove this as soon as unit test not using jasmine.Ajax
|
||||
{ provide: AdfHttpClient, useValue: null }
|
||||
]
|
||||
});
|
||||
fixture = TestBed.createComponent(PeopleSearchComponent);
|
||||
peopleSearchComponent = fixture.componentInstance;
|
||||
|
@@ -18,8 +18,9 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { PeopleComponent } from './people.component';
|
||||
import { LightUserRepresentation } from '@alfresco/js-api';
|
||||
import { AdfHttpClient } from '@alfresco/adf-core/api';
|
||||
import { of, throwError } from 'rxjs';
|
||||
import { PeopleProcessService } from '../../../services/people-process.service';
|
||||
import { PeopleProcessService } from '@alfresco/adf-process-services';
|
||||
|
||||
const fakeUser: LightUserRepresentation = {
|
||||
id: 0,
|
||||
@@ -44,7 +45,11 @@ describe('PeopleComponent', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [PeopleComponent]
|
||||
imports: [PeopleComponent],
|
||||
providers: [
|
||||
// TODO: remove this as soon as unit test not using jasmine.Ajax
|
||||
{ provide: AdfHttpClient, useValue: null }
|
||||
]
|
||||
});
|
||||
fixture = TestBed.createComponent(PeopleComponent);
|
||||
peopleProcessService = fixture.debugElement.injector.get(PeopleProcessService);
|
||||
|
@@ -20,6 +20,7 @@ import { ProcessFilterService } from './process-filter.service';
|
||||
import { ProcessInstanceFilterRepresentation, UserProcessInstanceFilterRepresentation } from '@alfresco/js-api';
|
||||
import { of } from 'rxjs';
|
||||
import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services';
|
||||
import { AdfHttpClient } from '@alfresco/adf-core/api';
|
||||
|
||||
declare let jasmine: any;
|
||||
|
||||
@@ -49,7 +50,12 @@ describe('Process filter', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }]
|
||||
imports: [],
|
||||
providers: [
|
||||
{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock },
|
||||
// TODO: remove this as soon as unit test not using jasmine.Ajax
|
||||
{ provide: AdfHttpClient, useValue: null }
|
||||
]
|
||||
});
|
||||
service = TestBed.inject(ProcessFilterService);
|
||||
});
|
||||
|
@@ -19,6 +19,7 @@ import { fakeAsync, TestBed } from '@angular/core/testing';
|
||||
import { PeopleProcessService } from './people-process.service';
|
||||
import { LightUserRepresentation } from '@alfresco/js-api';
|
||||
import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services';
|
||||
import { AdfHttpClient } from '@alfresco/adf-core/api';
|
||||
|
||||
declare let jasmine: any;
|
||||
|
||||
@@ -45,7 +46,12 @@ describe('PeopleProcessService', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }]
|
||||
imports: [],
|
||||
providers: [
|
||||
{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock },
|
||||
// TODO: remove this as soon as unit test not using jasmine.Ajax
|
||||
{ provide: AdfHttpClient, useValue: null }
|
||||
]
|
||||
});
|
||||
service = TestBed.inject(PeopleProcessService);
|
||||
});
|
||||
|
@@ -41,6 +41,7 @@ import { MatCheckboxHarness } from '@angular/material/checkbox/testing';
|
||||
import { MatMenuItemHarness } from '@angular/material/menu/testing';
|
||||
import { AlfrescoApiService, AlfrescoApiServiceMock } from '@alfresco/adf-content-services';
|
||||
import { CommonModule } from '@angular/common';
|
||||
import { AdfHttpClient } from '@alfresco/adf-core/api';
|
||||
|
||||
declare let jasmine: any;
|
||||
|
||||
@@ -109,7 +110,9 @@ describe('TaskListComponent', () => {
|
||||
providers: [
|
||||
TaskListService,
|
||||
{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock },
|
||||
{ provide: AppConfigService, useClass: AppConfigServiceMock }
|
||||
{ provide: AppConfigService, useClass: AppConfigServiceMock },
|
||||
// TODO: remove this as soon as unit test not using jasmine.Ajax
|
||||
{ provide: AdfHttpClient, useValue: null }
|
||||
]
|
||||
});
|
||||
appConfig = TestBed.inject(AppConfigService);
|
||||
|
Reference in New Issue
Block a user