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:
Denys Vuika
2018-04-23 09:55:22 +01:00
committed by Eugenio Romano
parent 9fbfcfa96e
commit 382ea3c1b3
204 changed files with 3093 additions and 4389 deletions

View File

@@ -16,12 +16,11 @@
*/
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { AppConfigService, CardViewUpdateService } from '@alfresco/adf-core';
import { AppConfigService, setupTestBed } from '@alfresco/adf-core';
import { ProcessInstance } from '../models/process-instance.model';
import { exampleProcess } from '../../mock';
import { ProcessService } from './../services/process.service';
import { ProcessInstanceHeaderComponent } from './process-instance-header.component';
import { ProcessTestingModule } from '../../testing/process.testing.module';
describe('ProcessInstanceHeaderComponent', () => {
@@ -29,25 +28,20 @@ describe('ProcessInstanceHeaderComponent', () => {
let fixture: ComponentFixture<ProcessInstanceHeaderComponent>;
let appConfigService: AppConfigService;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [
ProcessInstanceHeaderComponent
],
providers: [
ProcessService,
CardViewUpdateService,
AppConfigService
]
}).compileComponents();
}));
setupTestBed({
imports: [
ProcessTestingModule
]
});
beforeEach(() => {
fixture = TestBed.createComponent(ProcessInstanceHeaderComponent);
component = fixture.componentInstance;
component.processInstance = new ProcessInstance(exampleProcess);
appConfigService = TestBed.get(AppConfigService);
appConfigService.config['adf-process-instance-header'] = {};
});
it('should render empty component if no process details provided', () => {
@@ -163,13 +157,11 @@ describe('ProcessInstanceHeaderComponent', () => {
describe('Config Filtering', () => {
it('should show only the properties from the configuration file', () => {
appConfigService.config = Object.assign(appConfigService.config, {
'adf-process-instance-header': {
'presets': {
'properties': ['status', 'ended']
}
appConfigService.config['adf-process-instance-header'] = {
'presets': {
'properties': ['status', 'ended']
}
});
};
component.ngOnChanges({});
fixture.detectChanges();
const propertyList = fixture.nativeElement.querySelectorAll('.adf-property-list .adf-property');
@@ -180,17 +172,19 @@ describe('ProcessInstanceHeaderComponent', () => {
expect(propertyList[1].innerText).toContain('ADF_PROCESS_LIST.PROPERTIES.END_DATE');
});
it('should show all the default properties if there is no configuration', () => {
appConfigService.config = Object.assign(appConfigService.config, {});
it('should show all the default properties if there is no configuration', async(() => {
appConfigService.config['adf-process-instance-header'] = {};
component.ngOnChanges({});
fixture.detectChanges();
const propertyList = fixture.nativeElement.querySelectorAll('.adf-property-list .adf-property');
expect(propertyList).toBeDefined();
expect(propertyList).not.toBeNull();
expect(propertyList.length).toBe(component.properties.length);
expect(propertyList[0].innerText).toContain('ADF_PROCESS_LIST.PROPERTIES.STATUS');
expect(propertyList[2].innerText).toContain('ADF_PROCESS_LIST.PROPERTIES.CATEGORY');
});
fixture.whenStable().then(() => {
const propertyList = fixture.nativeElement.querySelectorAll('.adf-property-list .adf-property');
expect(propertyList).toBeDefined();
expect(propertyList).not.toBeNull();
expect(propertyList.length).toBe(component.properties.length);
expect(propertyList[0].innerText).toContain('ADF_PROCESS_LIST.PROPERTIES.STATUS');
expect(propertyList[2].innerText).toContain('ADF_PROCESS_LIST.PROPERTIES.CATEGORY');
});
}));
});
});