mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[AAE-4966] Extensible app config (#6914)
* merge app config from the extensions * improved service injection in unit tests * extra unit test * fix content tests * update code as per review * fix lint * fix lint * update code and tests * update schema
This commit is contained in:
@@ -142,16 +142,25 @@ describe('AspectListService', () => {
|
||||
describe('should fetch the list of the aspects', () => {
|
||||
|
||||
let service: AspectListService;
|
||||
const appConfigService: AppConfigService = new AppConfigService(null);
|
||||
|
||||
const aspectTypesApi = jasmine.createSpyObj('AspectsApi', ['listAspects']);
|
||||
const apiService: AlfrescoApiService = new AlfrescoApiService(null, null);
|
||||
const logService: LogService = new LogService(appConfigService);
|
||||
let appConfigService: AppConfigService;
|
||||
let apiService: AlfrescoApiService;
|
||||
let logService: LogService;
|
||||
let aspectTypesApi: any;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [ContentTestingModule]
|
||||
});
|
||||
|
||||
aspectTypesApi = jasmine.createSpyObj('AspectsApi', ['listAspects']);
|
||||
appConfigService = TestBed.inject(AppConfigService);
|
||||
apiService = TestBed.inject(AlfrescoApiService);
|
||||
logService = TestBed.inject(LogService);
|
||||
|
||||
spyOn(appConfigService, 'get').and.returnValue({ 'default': ['frs:AspectOne'] });
|
||||
spyOnProperty(apiService, 'aspectsApi').and.returnValue(aspectTypesApi);
|
||||
service = new AspectListService(apiService, appConfigService, null, logService);
|
||||
|
||||
service = TestBed.inject(AspectListService);
|
||||
});
|
||||
|
||||
it('should get the list of only available aspects', async(() => {
|
||||
|
@@ -16,16 +16,19 @@
|
||||
*/
|
||||
|
||||
import { CustomResourcesService } from './custom-resources.service';
|
||||
import { PaginationModel, AlfrescoApiServiceMock, AppConfigService, LogService, AppConfigServiceMock, StorageService } from '@alfresco/adf-core';
|
||||
import { PaginationModel } from '@alfresco/adf-core';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { ContentTestingModule } from '../../testing/content.testing.module';
|
||||
|
||||
describe('CustomResourcesService', () => {
|
||||
let customResourcesService: CustomResourcesService;
|
||||
|
||||
beforeEach(() => {
|
||||
const logService = new LogService(new AppConfigServiceMock(null));
|
||||
const alfrescoApiService = new AlfrescoApiServiceMock(new AppConfigService(null), new StorageService());
|
||||
TestBed.configureTestingModule({
|
||||
imports: [ContentTestingModule]
|
||||
});
|
||||
|
||||
customResourcesService = new CustomResourcesService(alfrescoApiService, logService);
|
||||
customResourcesService = TestBed.inject(CustomResourcesService);
|
||||
});
|
||||
|
||||
describe('loadFavorites', () => {
|
||||
|
@@ -15,9 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { AlfrescoApiServiceMock, AppConfigService, ContentService,
|
||||
setupTestBed, TranslationMock, AlfrescoApiService, StorageService
|
||||
} from '@alfresco/adf-core';
|
||||
import { setupTestBed } from '@alfresco/adf-core';
|
||||
import { FileNode, FolderNode } from '../../mock';
|
||||
import { ContentActionHandler } from '../models/content-action.model';
|
||||
import { DocumentActionsService } from './document-actions.service';
|
||||
@@ -36,21 +34,12 @@ describe('DocumentActionsService', () => {
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ContentTestingModule
|
||||
],
|
||||
providers: [
|
||||
{
|
||||
provide: AlfrescoApiService,
|
||||
useValue: new AlfrescoApiServiceMock(new AppConfigService(null), new StorageService())
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
const alfrescoApiService = new AlfrescoApiServiceMock(new AppConfigService(null), new StorageService());
|
||||
const contentService = TestBed.inject(ContentService);
|
||||
|
||||
documentListService = new DocumentListService(contentService, alfrescoApiService, null, null);
|
||||
service = new DocumentActionsService(null, null, new TranslationMock(), documentListService, contentService);
|
||||
documentListService = TestBed.inject(DocumentListService);
|
||||
service = TestBed.inject(DocumentActionsService);
|
||||
});
|
||||
|
||||
it('should register default download action', () => {
|
||||
|
@@ -15,10 +15,8 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { AlfrescoApiServiceMock, AlfrescoApiService,
|
||||
AppConfigService, ContentService, setupTestBed, LogService, AppConfigServiceMock, StorageService } from '@alfresco/adf-core';
|
||||
import { AlfrescoApiService, setupTestBed } from '@alfresco/adf-core';
|
||||
import { DocumentListService } from './document-list.service';
|
||||
import { CustomResourcesService } from './custom-resources.service';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { ContentTestingModule } from '../../testing/content.testing.module';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
@@ -72,11 +70,8 @@ describe('DocumentListService', () => {
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
const logService = new LogService(new AppConfigServiceMock(null));
|
||||
const contentService = TestBed.inject(ContentService);
|
||||
alfrescoApiService = new AlfrescoApiServiceMock(new AppConfigService(null), new StorageService());
|
||||
const customActionService = new CustomResourcesService(alfrescoApiService, logService);
|
||||
service = new DocumentListService(contentService, alfrescoApiService, logService, customActionService);
|
||||
alfrescoApiService = TestBed.inject(AlfrescoApiService);
|
||||
service = TestBed.inject(DocumentListService);
|
||||
jasmine.Ajax.install();
|
||||
});
|
||||
|
||||
|
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { AlfrescoApiServiceMock, AppConfigService, ContentService, setupTestBed, TranslationMock, StorageService } from '@alfresco/adf-core';
|
||||
import { AppConfigService, setupTestBed } from '@alfresco/adf-core';
|
||||
import { Observable } from 'rxjs';
|
||||
import { FileNode, FolderNode } from '../../mock';
|
||||
import { ContentActionHandler } from '../models/content-action.model';
|
||||
@@ -41,10 +41,8 @@ describe('FolderActionsService', () => {
|
||||
const appConfig: AppConfigService = TestBed.inject(AppConfigService);
|
||||
appConfig.config.ecmHost = 'http://localhost:9876/ecm';
|
||||
|
||||
const contentService = TestBed.inject(ContentService);
|
||||
const alfrescoApiService = new AlfrescoApiServiceMock(new AppConfigService(null), new StorageService());
|
||||
documentListService = new DocumentListService(contentService, alfrescoApiService, null, null);
|
||||
service = new FolderActionsService(null, documentListService, contentService, new TranslationMock());
|
||||
documentListService = TestBed.inject(DocumentListService);
|
||||
service = TestBed.inject(FolderActionsService);
|
||||
});
|
||||
|
||||
it('should register custom action handler', () => {
|
||||
|
@@ -19,6 +19,8 @@ import { SearchSortingPickerComponent } from './search-sorting-picker.component'
|
||||
import { SearchQueryBuilderService } from '../../search-query-builder.service';
|
||||
import { AppConfigService } from '@alfresco/adf-core';
|
||||
import { SearchConfiguration } from '../../search-configuration.interface';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { ContentTestingModule } from '../../../testing/content.testing.module';
|
||||
|
||||
describe('SearchSortingPickerComponent', () => {
|
||||
|
||||
@@ -26,12 +28,16 @@ describe('SearchSortingPickerComponent', () => {
|
||||
let component: SearchSortingPickerComponent;
|
||||
|
||||
const buildConfig = (searchSettings): AppConfigService => {
|
||||
const config = new AppConfigService(null);
|
||||
const config = TestBed.inject(AppConfigService);
|
||||
config.config.search = searchSettings;
|
||||
return config;
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [ContentTestingModule]
|
||||
});
|
||||
|
||||
const config: SearchConfiguration = {
|
||||
sorting: {
|
||||
options: [
|
||||
|
@@ -18,11 +18,19 @@
|
||||
import { SearchConfiguration } from './search-configuration.interface';
|
||||
import { AppConfigService } from '@alfresco/adf-core';
|
||||
import { SearchHeaderQueryBuilderService } from './search-header-query-builder.service';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { ContentTestingModule } from '../testing/content.testing.module';
|
||||
|
||||
describe('SearchHeaderQueryBuilderService', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [ContentTestingModule]
|
||||
});
|
||||
});
|
||||
|
||||
const buildConfig = (searchSettings): AppConfigService => {
|
||||
const config = new AppConfigService(null);
|
||||
const config = TestBed.inject(AppConfigService);
|
||||
config.config['search-headers'] = searchSettings;
|
||||
return config;
|
||||
};
|
||||
|
@@ -19,11 +19,19 @@ import { SearchQueryBuilderService } from './search-query-builder.service';
|
||||
import { SearchConfiguration } from './search-configuration.interface';
|
||||
import { AppConfigService } from '@alfresco/adf-core';
|
||||
import { FacetField } from './facet-field.interface';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { ContentTestingModule } from '../testing/content.testing.module';
|
||||
|
||||
describe('SearchQueryBuilder', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [ContentTestingModule]
|
||||
});
|
||||
});
|
||||
|
||||
const buildConfig = (searchSettings): AppConfigService => {
|
||||
const config = new AppConfigService(null);
|
||||
const config = TestBed.inject(AppConfigService);
|
||||
config.config.search = searchSettings;
|
||||
return config;
|
||||
};
|
||||
|
Reference in New Issue
Block a user