[AAE-5139] User name style and Discovery service initialization fix (#7010)

* [AAE-5139] User name style fix and Discovery serice fixed

* * fixed unit test

* * fixed test and us latest js-api events

* * tests fixed

* * update js api

* * fixed test and lint
This commit is contained in:
Dharan
2021-05-12 00:10:21 +05:30
committed by GitHub
parent 453198c1e8
commit e603486b00
31 changed files with 34543 additions and 132 deletions

View File

@@ -36,12 +36,12 @@ describe('AppListCloudComponent', () => {
const mock = {
oauth2Auth: {
callCustomApi: () => Promise.resolve(fakeApplicationInstance),
on: jasmine.createSpy('on')
callCustomApi: () => Promise.resolve(fakeApplicationInstance)
},
isEcmLoggedIn() {
return false;
}
},
reply: jasmine.createSpy('reply')
};
@Component({

View File

@@ -32,12 +32,12 @@ describe('AppsProcessCloudService', () => {
const apiMock = {
oauth2Auth: {
callCustomApi: () => Promise.resolve({list : { entries: [ {entry: fakeApplicationInstance[0]}, {entry: fakeApplicationInstance[1]}] }}),
on: jasmine.createSpy('on')
callCustomApi: () => Promise.resolve({list : { entries: [ {entry: fakeApplicationInstance[0]}, {entry: fakeApplicationInstance[1]}] }})
},
isEcmLoggedIn() {
return false;
}
},
reply: jasmine.createSpy('reply')
};
setupTestBed({

View File

@@ -20,7 +20,6 @@ import { By } from '@angular/platform-browser';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { Observable, of, throwError } from 'rxjs';
import {
AppConfigService,
CoreModule,
FormFieldModel,
FormFieldTypes,
@@ -33,7 +32,8 @@ import {
VersionCompatibilityService,
FormService,
UploadWidgetContentLinkModel,
ContentLinkModel
ContentLinkModel,
AlfrescoApiService
} from '@alfresco/adf-core';
import { ProcessServiceCloudTestingModule } from '../../testing/process-service-cloud.testing.module';
import { FormCloudService } from '../services/form-cloud.service';
@@ -53,6 +53,14 @@ import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { CloudFormRenderingService } from './cloud-form-rendering.service';
import { Node } from '@alfresco/js-api';
const mockOauth2Auth = {
oauth2Auth: {
callCustomApi: () => Promise.resolve()
},
isEcmLoggedIn: jasmine.createSpy('isEcmLoggedIn'),
reply: jasmine.createSpy('reply')
};
describe('FormCloudComponent', () => {
let formCloudService: FormCloudService;
let fixture: ComponentFixture<FormCloudComponent>;
@@ -111,6 +119,9 @@ describe('FormCloudComponent', () => {
});
beforeEach(async(() => {
const apiService = TestBed.inject(AlfrescoApiService);
spyOn(apiService, 'getInstance').and.returnValue(mockOauth2Auth);
formRenderingService = TestBed.inject(CloudFormRenderingService);
formCloudService = TestBed.inject(FormCloudService);
@@ -119,9 +130,6 @@ describe('FormCloudComponent', () => {
visibilityService = TestBed.inject(WidgetVisibilityService);
spyOn(visibilityService, 'refreshVisibility').and.callThrough();
const appConfigService = TestBed.inject(AppConfigService);
spyOn(appConfigService, 'get').and.returnValue([]);
fixture = TestBed.createComponent(FormCloudComponent);
formComponent = fixture.componentInstance;
fixture.detectChanges();
@@ -999,13 +1007,11 @@ describe('FormCloudComponent', () => {
expect(getLabelValue('dateField')).toEqual('Date field (D-M-YYYY)');
expect(getLabelValue('amountField')).toEqual('Amount field');
expect(translateService.getLangs()).toEqual(['en', '']);
fixture.ngZone.run(() => translateService.use('fr'));
await fixture.whenStable();
fixture.detectChanges();
expect(translateService.getLangs()).toEqual(['en', '', 'fr']);
expect(getLabelValue('textField')).toEqual('Champ de texte');
expect(getLabelValue('fildUploadField')).toEqual('Téléchargement de fichiers');
expect(getLabelValue('dateField')).toEqual('Champ de date (D-M-YYYY)');
@@ -1139,8 +1145,9 @@ describe('retrieve metadata on submit', () => {
};
beforeEach(async(() => {
const appConfigService = TestBed.inject(AppConfigService);
spyOn(appConfigService, 'get').and.returnValue([]);
const apiService = TestBed.inject(AlfrescoApiService);
spyOn(apiService, 'getInstance').and.returnValue(mockOauth2Auth);
formService = TestBed.inject(FormService);
fixture = TestBed.createComponent(FormCloudComponent);

View File

@@ -29,7 +29,7 @@ const responseBody = {
{ id: 'id', name: 'name', formKey: 'form-key' }
};
const oauth2Auth = jasmine.createSpyObj('oauth2Auth', ['callCustomApi', 'on']);
const oauth2Auth = jasmine.createSpyObj('oauth2Auth', ['callCustomApi']);
describe('Form Cloud service', () => {
@@ -54,7 +54,8 @@ describe('Form Cloud service', () => {
oauth2Auth: oauth2Auth,
isEcmLoggedIn() {
return false;
}
},
reply: jasmine.createSpy('reply')
});
});

View File

@@ -74,7 +74,8 @@ describe('Form Definition Selector Cloud Service', () => {
oauth2Auth: oauth2Auth,
isEcmLoggedIn() {
return false;
}
},
reply: jasmine.createSpy('reply')
});
});

View File

@@ -42,12 +42,12 @@ describe('GroupCloudComponent', () => {
const mock = {
oauth2Auth: {
callCustomApi: () => Promise.resolve(mockIdentityGroups),
on: jasmine.createSpy('on')
callCustomApi: () => Promise.resolve(mockIdentityGroups)
},
isEcmLoggedIn() {
return false;
}
},
reply: jasmine.createSpy('reply')
};
function getElement<T = HTMLElement>(selector: string): T {

View File

@@ -42,12 +42,12 @@ describe('PeopleCloudComponent', () => {
const mock = {
oauth2Auth: {
callCustomApi: () => Promise.resolve(mockUsers),
on: jasmine.createSpy('on')
callCustomApi: () => Promise.resolve(mockUsers)
},
isEcmLoggedIn() {
return false;
}
},
reply: jasmine.createSpy('reply')
};
const mockPreselectedUsers = [

View File

@@ -66,12 +66,12 @@ describe('EditProcessFilterCloudComponent', () => {
const mock = {
oauth2Auth: {
callCustomApi: () => Promise.resolve(fakeApplicationInstance),
on: jasmine.createSpy('on')
callCustomApi: () => Promise.resolve(fakeApplicationInstance)
},
isEcmLoggedIn() {
return false;
}
},
reply: jasmine.createSpy('reply')
};
setupTestBed({

View File

@@ -45,12 +45,12 @@ describe('NotificationCloudService', () => {
const apiServiceMock = {
oauth2Auth: {
token: '1234567',
on: jasmine.createSpy('on')
token: '1234567'
},
isEcmLoggedIn() {
return false;
}
},
reply: jasmine.createSpy('reply')
};
setupTestBed({

View File

@@ -38,12 +38,12 @@ describe('PreferenceService', () => {
oauth2Auth: {
callCustomApi: () => {
return Promise.resolve(mockResponse);
},
on: jasmine.createSpy('on')
}
},
isEcmLoggedIn() {
return false;
}
},
reply: jasmine.createSpy('reply')
};
}

View File

@@ -40,12 +40,12 @@ describe('StartTaskCloudComponent', () => {
const mock = {
oauth2Auth: {
callCustomApi: () => Promise.resolve(taskDetailsMock),
on: jasmine.createSpy('on')
callCustomApi: () => Promise.resolve(taskDetailsMock)
},
isEcmLoggedIn() {
return false;
}
},
reply: jasmine.createSpy('reply')
};
const mockUser: IdentityUserModel = {username: 'currentUser', firstName: 'Test', lastName: 'User', email: 'currentUser@test.com'};

View File

@@ -53,12 +53,12 @@ describe('EditTaskFilterCloudComponent', () => {
const mock = {
oauth2Auth: {
callCustomApi: () => Promise.resolve(fakeApplicationInstance),
on: jasmine.createSpy('on')
callCustomApi: () => Promise.resolve(fakeApplicationInstance)
},
isEcmLoggedIn() {
return false;
}
},
reply: jasmine.createSpy('reply')
};
setupTestBed({

View File

@@ -51,12 +51,12 @@ describe('TaskHeaderCloudComponent', () => {
const mock = {
oauth2Auth: {
callCustomApi: () => Promise.resolve({}),
on: jasmine.createSpy('on')
callCustomApi: () => Promise.resolve({})
},
isEcmLoggedIn() {
return false;
}
},
reply: jasmine.createSpy('reply')
};
setupTestBed({

View File

@@ -31,12 +31,12 @@ describe('Activiti ServiceTaskList Cloud Service', () => {
oauth2Auth: {
callCustomApi: (_queryUrl, _operation, _context, queryParams) => {
return Promise.resolve(queryParams);
},
on: jasmine.createSpy('on')
}
},
isEcmLoggedIn() {
return false;
}
},
reply: jasmine.createSpy('reply')
};
}

View File

@@ -32,12 +32,12 @@ describe('TaskListCloudService', () => {
oauth2Auth: {
callCustomApi : (_queryUrl, _operation, _context, queryParams) => {
return Promise.resolve(queryParams);
},
on: jasmine.createSpy('on')
}
},
isEcmLoggedIn() {
return false;
}
},
reply: jasmine.createSpy('reply')
};
}