mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-5415] remove deprecated async method (#7171)
* remove deprecated async method * fix tests and code * test fixes * fix tests
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
|
||||
import { Component, DebugElement, SimpleChange, NgModule, Injector, ComponentFactoryResolver, ViewChild } from '@angular/core';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { Observable, of, throwError } from 'rxjs';
|
||||
import {
|
||||
CoreModule,
|
||||
@@ -118,7 +118,7 @@ describe('FormCloudComponent', () => {
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(async(() => {
|
||||
beforeEach(() => {
|
||||
const apiService = TestBed.inject(AlfrescoApiService);
|
||||
spyOn(apiService, 'getInstance').and.returnValue(mockOauth2Auth);
|
||||
|
||||
@@ -133,7 +133,7 @@ describe('FormCloudComponent', () => {
|
||||
fixture = TestBed.createComponent(FormCloudComponent);
|
||||
formComponent = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
}));
|
||||
});
|
||||
|
||||
it('should register custom [upload] widget', () => {
|
||||
const widget = buildWidget('upload', fixture.componentRef.injector);
|
||||
@@ -1154,7 +1154,7 @@ describe('retrieve metadata on submit', () => {
|
||||
}
|
||||
};
|
||||
|
||||
beforeEach(async(() => {
|
||||
beforeEach(() => {
|
||||
const apiService = TestBed.inject(AlfrescoApiService);
|
||||
spyOn(apiService, 'getInstance').and.returnValue(mockOauth2Auth);
|
||||
|
||||
@@ -1164,7 +1164,7 @@ describe('retrieve metadata on submit', () => {
|
||||
formComponent = fixture.componentInstance;
|
||||
formComponent.form = formComponent.parseForm(fakeMetadataForm);
|
||||
fixture.detectChanges();
|
||||
}));
|
||||
});
|
||||
|
||||
it('should set values when updateFormValuesRequested is updated', async () => {
|
||||
formComponent.form.values['pfx_property_three'] = {};
|
||||
|
@@ -405,7 +405,7 @@ describe('AttachFileCloudWidgetComponent', () => {
|
||||
expect(widget.rootNodeId).toEqual('-my-');
|
||||
});
|
||||
|
||||
it('should return the application name in case -appname- placeholder is present', async() => {
|
||||
it('should return the application name in case -appname- placeholder is present', () => {
|
||||
appConfigService.config = Object.assign(appConfigService.config, {
|
||||
'alfresco-deployed-apps': [
|
||||
{
|
||||
@@ -417,7 +417,7 @@ describe('AttachFileCloudWidgetComponent', () => {
|
||||
expect(widget.replaceAppNameAliasWithValue('/myfiles/-appname-/folder')).toBe('/myfiles/fakeapp/folder');
|
||||
});
|
||||
|
||||
it('should return the same value in case -appname- placeholder is NOT present', async() => {
|
||||
it('should return the same value in case -appname- placeholder is NOT present', () => {
|
||||
expect(widget.replaceAppNameAliasWithValue('/myfiles/fakepath/folder')).toBe('/myfiles/fakepath/folder');
|
||||
});
|
||||
|
||||
|
@@ -30,7 +30,7 @@ describe('ProcessNameCloudPipe', () => {
|
||||
const defaultName = 'default-name';
|
||||
const datetimeIdentifier = '%{datetime}';
|
||||
const processDefinitionIdentifier = '%{processDefinition}';
|
||||
const mockCurrentDate = new Date('Wed Oct 23 2019');
|
||||
const mockCurrentDate: number = new Date('Wed Oct 23 2019').getTime();
|
||||
const mockLocalizedCurrentDate = 'Oct 23, 2019, 12:00:00 AM';
|
||||
const nameWithProcessDefinitionIdentifier = `${defaultName} - ${processDefinitionIdentifier}`;
|
||||
const nameWithDatetimeIdentifier = `${defaultName} - ${datetimeIdentifier}`;
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { async, TestBed } from '@angular/core/testing';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { setupTestBed, IdentityUserService } from '@alfresco/adf-core';
|
||||
import { of } from 'rxjs';
|
||||
import { ProcessFilterCloudService } from './process-filter-cloud.service';
|
||||
@@ -50,7 +50,7 @@ describe('ProcessFilterCloudService', () => {
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(async(() => {
|
||||
beforeEach(() => {
|
||||
service = TestBed.inject(ProcessFilterCloudService);
|
||||
|
||||
const preferenceCloudService = service.preferenceService;
|
||||
@@ -61,7 +61,7 @@ describe('ProcessFilterCloudService', () => {
|
||||
getPreferenceByKeySpy = spyOn(preferenceCloudService, 'getPreferenceByKey').and.returnValue(of(fakeProcessCloudFilters));
|
||||
getPreferencesSpy = spyOn(preferenceCloudService, 'getPreferences').and.returnValue(of(fakeProcessCloudFilterEntries));
|
||||
getCurrentUserInfoSpy = spyOn(identityUserService, 'getCurrentUserInfo').and.returnValue(identityUserMock);
|
||||
}));
|
||||
});
|
||||
|
||||
it('should create processfilter key by using appName and the username', (done) => {
|
||||
service.getProcessFilters('mock-appName').subscribe((res: any) => {
|
||||
|
@@ -14,7 +14,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { async, TestBed } from '@angular/core/testing';
|
||||
import { fakeAsync, TestBed } from '@angular/core/testing';
|
||||
import { setupTestBed, AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { ProcessListCloudService } from './process-list-cloud.service';
|
||||
import { ProcessQueryCloudRequestModel } from '../models/process-cloud-query-request.model';
|
||||
@@ -56,13 +56,13 @@ describe('ProcessListCloudService', () => {
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(async(() => {
|
||||
beforeEach(fakeAsync(() => {
|
||||
alfrescoApiService = TestBed.inject(AlfrescoApiService);
|
||||
service = TestBed.inject(ProcessListCloudService);
|
||||
}));
|
||||
|
||||
it('should append to the call all the parameters', (done) => {
|
||||
const processRequest: ProcessQueryCloudRequestModel = <ProcessQueryCloudRequestModel> { appName: 'fakeName', skipCount: 0, maxItems: 20, service: 'fake-service' };
|
||||
const processRequest = { appName: 'fakeName', skipCount: 0, maxItems: 20, service: 'fake-service' } as ProcessQueryCloudRequestModel;
|
||||
spyOn(alfrescoApiService, 'getInstance').and.callFake(returnCallQueryParameters);
|
||||
service.getProcessByRequest(processRequest).subscribe((res) => {
|
||||
expect(res).toBeDefined();
|
||||
@@ -75,7 +75,7 @@ describe('ProcessListCloudService', () => {
|
||||
});
|
||||
|
||||
it('should concat the app name to the request url', (done) => {
|
||||
const processRequest: ProcessQueryCloudRequestModel = <ProcessQueryCloudRequestModel> { appName: 'fakeName', skipCount: 0, maxItems: 20, service: 'fake-service' };
|
||||
const processRequest = { appName: 'fakeName', skipCount: 0, maxItems: 20, service: 'fake-service' } as ProcessQueryCloudRequestModel;
|
||||
spyOn(alfrescoApiService, 'getInstance').and.callFake(returnCallUrl);
|
||||
service.getProcessByRequest(processRequest).subscribe((requestUrl) => {
|
||||
expect(requestUrl).toBeDefined();
|
||||
@@ -86,10 +86,10 @@ describe('ProcessListCloudService', () => {
|
||||
});
|
||||
|
||||
it('should concat the sorting to append as parameters', (done) => {
|
||||
const processRequest: ProcessQueryCloudRequestModel = <ProcessQueryCloudRequestModel> {
|
||||
const processRequest = {
|
||||
appName: 'fakeName', skipCount: 0, maxItems: 20, service: 'fake-service',
|
||||
sorting: [{ orderBy: 'NAME', direction: 'DESC' }, { orderBy: 'TITLE', direction: 'ASC' }]
|
||||
};
|
||||
} as ProcessQueryCloudRequestModel;
|
||||
spyOn(alfrescoApiService, 'getInstance').and.callFake(returnCallQueryParameters);
|
||||
service.getProcessByRequest(processRequest).subscribe((res) => {
|
||||
expect(res).toBeDefined();
|
||||
@@ -100,7 +100,7 @@ describe('ProcessListCloudService', () => {
|
||||
});
|
||||
|
||||
it('should return an error when app name is not specified', (done) => {
|
||||
const processRequest: ProcessQueryCloudRequestModel = <ProcessQueryCloudRequestModel> { appName: null };
|
||||
const processRequest = { appName: null } as ProcessQueryCloudRequestModel;
|
||||
spyOn(alfrescoApiService, 'getInstance').and.callFake(returnCallUrl);
|
||||
service.getProcessByRequest(processRequest).subscribe(
|
||||
() => { },
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { TestBed, async } from '@angular/core/testing';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { AlfrescoApiService, setupTestBed } from '@alfresco/adf-core';
|
||||
import { ProcessServiceCloudTestingModule } from '../testing/process-service-cloud.testing.module';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
@@ -60,7 +60,7 @@ describe('NotificationCloudService', () => {
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(async(() => {
|
||||
beforeEach(() => {
|
||||
service = TestBed.inject(NotificationCloudService);
|
||||
apollo = TestBed.inject(Apollo);
|
||||
apiService = TestBed.inject(AlfrescoApiService);
|
||||
@@ -69,7 +69,7 @@ describe('NotificationCloudService', () => {
|
||||
service.appsListening = [];
|
||||
apolloCreateSpy = spyOn(apollo, 'createNamed');
|
||||
apolloSubscribeSpy = spyOn(apollo, 'use').and.returnValue(useMock);
|
||||
}));
|
||||
});
|
||||
|
||||
it('should not create more than one websocket per app if it was already created', () => {
|
||||
service.makeGQLQuery('myAppName', queryMock);
|
||||
|
@@ -15,8 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { TestBed, async } from '@angular/core/testing';
|
||||
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { UserPreferenceCloudService } from './user-preference-cloud.service';
|
||||
import { setupTestBed, AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { mockPreferences, getMockPreference, createMockPreference, updateMockPreference } from '../mock/user-preference.mock';
|
||||
@@ -63,11 +62,11 @@ describe('PreferenceService', () => {
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(async(() => {
|
||||
beforeEach(() => {
|
||||
service = TestBed.inject(UserPreferenceCloudService);
|
||||
alfrescoApiMock = TestBed.inject(AlfrescoApiService);
|
||||
getInstanceSpy = spyOn(alfrescoApiMock, 'getInstance').and.returnValue(apiMock(mockPreferences));
|
||||
}));
|
||||
});
|
||||
|
||||
it('should return the preferences', (done) => {
|
||||
service.getPreferences('mock-app-name').subscribe((res: any) => {
|
||||
|
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { async, TestBed } from '@angular/core/testing';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { setupTestBed, AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { ServiceTaskListCloudService } from './service-task-list-cloud.service';
|
||||
import { ServiceTaskQueryCloudRequestModel } from '../models/service-task-cloud.model';
|
||||
@@ -59,10 +59,10 @@ describe('Activiti ServiceTaskList Cloud Service', () => {
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(async(() => {
|
||||
beforeEach(() => {
|
||||
alfrescoApiService = TestBed.inject(AlfrescoApiService);
|
||||
service = TestBed.inject(ServiceTaskListCloudService);
|
||||
}));
|
||||
});
|
||||
|
||||
it('should append to the call all the parameters', (done) => {
|
||||
const taskRequest: ServiceTaskQueryCloudRequestModel = <ServiceTaskQueryCloudRequestModel> { appName: 'fakeName', skipCount: 0, maxItems: 20, service: 'fake-service' };
|
||||
|
Reference in New Issue
Block a user