mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
unit test performance (#3194)
* DataTable (-4 sec) * PaginationComponent (-1 sec) * DocumentList * custom testbed setup, test upgrades * test fixes * more test fixes * remove fdescribe * test fixes * test fixes * more test fixes * test fixes * upgrade tests * update tests * upgrade tests * upgrade tests * upgrade tests * upgrade tests * update tests * translate loader fixes * auth and cookie fixes * upgrade tests * upgrade tests * test fixes * almost there * diable broken tests * process tests (part 1) * fix lint issues * another test upgrade * almost there * cleanup * insights testing upgrade * improve tests * tests cleanup * tests cleanup * cleanup tests * test cleanup * favorite nodes tests * rebase fix syntax * fix core test * give up test focus * flush tabs * fix search test * Update document-list.component.spec.ts * fix document list lock * increase tick time * remove duplicate test
This commit is contained in:
committed by
Eugenio Romano
parent
9fbfcfa96e
commit
382ea3c1b3
+10
-34
@@ -17,48 +17,24 @@
|
||||
|
||||
/*tslint:disable: ban*/
|
||||
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { MinimalNodeEntryEntity } from 'alfresco-js-api';
|
||||
import { ContentMetadataCardComponent } from './content-metadata-card.component';
|
||||
import { ContentMetadataComponent } from '../content-metadata/content-metadata.component';
|
||||
import { MatExpansionModule, MatCardModule, MatButtonModule, MatIconModule } from '@angular/material';
|
||||
import { ContentMetadataService } from '../../services/content-metadata.service';
|
||||
import { BasicPropertiesService } from '../../services/basic-properties.service';
|
||||
import { PropertyGroupTranslatorService } from '../../services/property-groups-translator.service';
|
||||
import { PropertyDescriptorsService } from '../../services/property-descriptors.service';
|
||||
import { ContentMetadataConfigFactory } from '../../services/config/content-metadata-config.factory';
|
||||
import { ContentService, PermissionsEnum } from '@alfresco/adf-core';
|
||||
import { setupTestBed, PermissionsEnum } from '@alfresco/adf-core';
|
||||
import { ContentTestingModule } from '../../../testing/content.testing.module';
|
||||
|
||||
describe('ContentMetadataCardComponent', () => {
|
||||
|
||||
let component: ContentMetadataCardComponent,
|
||||
fixture: ComponentFixture<ContentMetadataCardComponent>,
|
||||
node: MinimalNodeEntryEntity,
|
||||
preset = 'custom-preset';
|
||||
let component: ContentMetadataCardComponent;
|
||||
let fixture: ComponentFixture<ContentMetadataCardComponent>;
|
||||
let node: MinimalNodeEntryEntity;
|
||||
let preset = 'custom-preset';
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
MatExpansionModule,
|
||||
MatCardModule,
|
||||
MatButtonModule,
|
||||
MatIconModule
|
||||
],
|
||||
declarations: [
|
||||
ContentMetadataCardComponent,
|
||||
ContentMetadataComponent
|
||||
],
|
||||
providers: [
|
||||
ContentMetadataService,
|
||||
BasicPropertiesService,
|
||||
PropertyGroupTranslatorService,
|
||||
ContentMetadataConfigFactory,
|
||||
PropertyDescriptorsService,
|
||||
ContentService
|
||||
]
|
||||
}).compileComponents();
|
||||
}));
|
||||
setupTestBed({
|
||||
imports: [ContentTestingModule]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ContentMetadataCardComponent);
|
||||
|
||||
+15
-34
@@ -22,51 +22,33 @@ import { SimpleChange } from '@angular/core';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { MinimalNodeEntryEntity } from 'alfresco-js-api';
|
||||
import { ContentMetadataComponent } from './content-metadata.component';
|
||||
import { MatExpansionModule, MatButtonModule, MatIconModule } from '@angular/material';
|
||||
import { ContentMetadataService } from '../../services/content-metadata.service';
|
||||
import { BasicPropertiesService } from '../../services/basic-properties.service';
|
||||
import { PropertyGroupTranslatorService } from '../../services/property-groups-translator.service';
|
||||
import { PropertyDescriptorsService } from '../../services/property-descriptors.service';
|
||||
import {
|
||||
CardViewBaseItemModel,
|
||||
CardViewComponent,
|
||||
CardViewUpdateService,
|
||||
NodesApiService,
|
||||
LogService
|
||||
} from '@alfresco/adf-core';
|
||||
LogService,
|
||||
setupTestBed
|
||||
} from '@alfresco/adf-core';
|
||||
import { ErrorObservable } from 'rxjs/observable/ErrorObservable';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { ContentMetadataConfigFactory } from '../../services/config/content-metadata-config.factory';
|
||||
import { ContentTestingModule } from '../../../testing/content.testing.module';
|
||||
|
||||
describe('ContentMetadataComponent', () => {
|
||||
|
||||
let component: ContentMetadataComponent,
|
||||
fixture: ComponentFixture<ContentMetadataComponent>,
|
||||
node: MinimalNodeEntryEntity,
|
||||
folderNode: MinimalNodeEntryEntity,
|
||||
preset = 'custom-preset';
|
||||
let component: ContentMetadataComponent;
|
||||
let fixture: ComponentFixture<ContentMetadataComponent>;
|
||||
let node: MinimalNodeEntryEntity;
|
||||
let folderNode: MinimalNodeEntryEntity;
|
||||
let preset = 'custom-preset';
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
MatExpansionModule,
|
||||
MatButtonModule,
|
||||
MatIconModule
|
||||
],
|
||||
declarations: [
|
||||
ContentMetadataComponent
|
||||
],
|
||||
providers: [
|
||||
ContentMetadataService,
|
||||
BasicPropertiesService,
|
||||
PropertyGroupTranslatorService,
|
||||
PropertyDescriptorsService,
|
||||
ContentMetadataConfigFactory,
|
||||
NodesApiService,
|
||||
{ provide: LogService, useValue: { error: jasmine.createSpy('error') } }
|
||||
]
|
||||
}).compileComponents();
|
||||
}));
|
||||
setupTestBed({
|
||||
imports: [ContentTestingModule],
|
||||
providers: [
|
||||
{ provide: LogService, useValue: { error: jasmine.createSpy('error') } }
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ContentMetadataComponent);
|
||||
@@ -96,7 +78,6 @@ describe('ContentMetadataComponent', () => {
|
||||
|
||||
afterEach(() => {
|
||||
fixture.destroy();
|
||||
TestBed.resetTestingModule();
|
||||
});
|
||||
|
||||
describe('Default input param values', () => {
|
||||
|
||||
+16
-18
@@ -15,29 +15,31 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { async, TestBed } from '@angular/core/testing';
|
||||
import { AppConfigService, LogService } from '@alfresco/adf-core';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { AppConfigService, LogService, setupTestBed } from '@alfresco/adf-core';
|
||||
import { IndifferentConfigService } from './indifferent-config.service';
|
||||
import { AspectOrientedConfigService } from './aspect-oriented-config.service';
|
||||
import { LayoutOrientedConfigService } from './layout-oriented-config.service';
|
||||
import { ContentMetadataConfigFactory } from './content-metadata-config.factory';
|
||||
import { ContentMetadataConfig } from '../../interfaces/content-metadata.interfaces';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
|
||||
describe('ContentMetadataConfigFactory', () => {
|
||||
|
||||
let factory: ContentMetadataConfigFactory,
|
||||
appConfig: AppConfigService,
|
||||
config: ContentMetadataConfig;
|
||||
let factory: ContentMetadataConfigFactory;
|
||||
let appConfig: AppConfigService;
|
||||
let config: ContentMetadataConfig;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [
|
||||
ContentMetadataConfigFactory,
|
||||
AppConfigService,
|
||||
{ provide: LogService, useValue: { error: () => {} }}
|
||||
]
|
||||
}).compileComponents();
|
||||
}));
|
||||
setupTestBed({
|
||||
imports: [
|
||||
HttpClientModule
|
||||
],
|
||||
providers: [
|
||||
ContentMetadataConfigFactory,
|
||||
AppConfigService,
|
||||
{ provide: LogService, useValue: { error: () => {} }}
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
factory = TestBed.get(ContentMetadataConfigFactory);
|
||||
@@ -52,10 +54,6 @@ describe('ContentMetadataConfigFactory', () => {
|
||||
};
|
||||
}
|
||||
|
||||
afterEach(() => {
|
||||
TestBed.resetTestingModule();
|
||||
});
|
||||
|
||||
describe('get', () => {
|
||||
|
||||
let logService;
|
||||
|
||||
+8
-15
@@ -15,25 +15,22 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { async, TestBed } from '@angular/core/testing';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { PropertyDescriptorsService } from './property-descriptors.service';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { AlfrescoApiService, setupTestBed } from '@alfresco/adf-core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { ClassesApi } from 'alfresco-js-api';
|
||||
import { PropertyGroup } from '../interfaces/content-metadata.interfaces';
|
||||
import { ContentTestingModule } from '../../testing/content.testing.module';
|
||||
|
||||
describe('PropertyDescriptorLoaderService', () => {
|
||||
|
||||
let service: PropertyDescriptorsService,
|
||||
classesApi: ClassesApi;
|
||||
let service: PropertyDescriptorsService;
|
||||
let classesApi: ClassesApi;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [
|
||||
PropertyDescriptorsService
|
||||
]
|
||||
}).compileComponents();
|
||||
}));
|
||||
setupTestBed({
|
||||
imports: [ContentTestingModule]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
service = TestBed.get(PropertyDescriptorsService);
|
||||
@@ -41,10 +38,6 @@ describe('PropertyDescriptorLoaderService', () => {
|
||||
classesApi = alfrescoApiService.classesApi;
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
TestBed.resetTestingModule();
|
||||
});
|
||||
|
||||
it('should load the groups passed by paramter', () => {
|
||||
spyOn(classesApi, 'getClass');
|
||||
|
||||
|
||||
+15
-19
@@ -15,7 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { async, TestBed } from '@angular/core/testing';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { PropertyGroupTranslatorService } from './property-groups-translator.service';
|
||||
import { Property, OrganisedPropertyGroup } from '../interfaces/content-metadata.interfaces';
|
||||
import {
|
||||
@@ -25,25 +25,25 @@ import {
|
||||
CardViewFloatItemModel,
|
||||
LogService,
|
||||
CardViewBoolItemModel,
|
||||
CardViewDatetimeItemModel
|
||||
CardViewDatetimeItemModel,
|
||||
setupTestBed
|
||||
} from '@alfresco/adf-core';
|
||||
import { ContentTestingModule } from '../../testing/content.testing.module';
|
||||
|
||||
describe('PropertyGroupTranslatorService', () => {
|
||||
|
||||
let service: PropertyGroupTranslatorService,
|
||||
propertyGroups: OrganisedPropertyGroup[],
|
||||
propertyGroup: OrganisedPropertyGroup,
|
||||
property: Property,
|
||||
propertyValues: { [key: string]: any };
|
||||
let service: PropertyGroupTranslatorService;
|
||||
let propertyGroups: OrganisedPropertyGroup[];
|
||||
let propertyGroup: OrganisedPropertyGroup;
|
||||
let property: Property;
|
||||
let propertyValues: { [key: string]: any };
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [
|
||||
PropertyGroupTranslatorService,
|
||||
{ provide: LogService, useValue: { error: () => {} }}
|
||||
]
|
||||
}).compileComponents();
|
||||
}));
|
||||
setupTestBed({
|
||||
imports: [ContentTestingModule],
|
||||
providers: [
|
||||
{ provide: LogService, useValue: { error: () => {} }}
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
service = TestBed.get(PropertyGroupTranslatorService);
|
||||
@@ -63,10 +63,6 @@ describe('PropertyGroupTranslatorService', () => {
|
||||
propertyGroups = [];
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
TestBed.resetTestingModule();
|
||||
});
|
||||
|
||||
describe('General transformation', () => {
|
||||
|
||||
it('should translate EVERY properties in ONE group properly', () => {
|
||||
|
||||
Reference in New Issue
Block a user