mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +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
@@ -16,10 +16,10 @@
|
||||
*/
|
||||
|
||||
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
import { async, ComponentFixture, TestBed, tick, fakeAsync } from '@angular/core/testing';
|
||||
import { ComponentFixture, TestBed, tick, fakeAsync } from '@angular/core/testing';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { VersionListComponent } from './version-list.component';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { AlfrescoApiService, setupTestBed, CoreModule, AlfrescoApiServiceMock } from '@alfresco/adf-core';
|
||||
import { MatDialog } from '@angular/material';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
@@ -32,14 +32,18 @@ describe('VersionListComponent', () => {
|
||||
const nodeId = 'test-id';
|
||||
const versionId = '1.0';
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [
|
||||
VersionListComponent
|
||||
],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
}).compileComponents();
|
||||
}));
|
||||
setupTestBed({
|
||||
imports: [
|
||||
CoreModule.forRoot()
|
||||
],
|
||||
declarations: [
|
||||
VersionListComponent
|
||||
],
|
||||
providers: [
|
||||
{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }
|
||||
],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
fixture.destroy();
|
||||
@@ -99,24 +103,6 @@ describe('VersionListComponent', () => {
|
||||
expect(alfrescoApiService.versionsApi.deleteVersion).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should reload list once a version is deleted', fakeAsync(() => {
|
||||
spyOn(component, 'loadVersionHistory').and.stub();
|
||||
|
||||
spyOn(dialog, 'open').and.returnValue({
|
||||
afterClosed() {
|
||||
return Observable.of(true);
|
||||
}
|
||||
});
|
||||
|
||||
spyOn(alfrescoApiService.versionsApi, 'deleteVersion').and.returnValue(Promise.resolve(true));
|
||||
|
||||
component.deleteVersion(versionId);
|
||||
|
||||
tick();
|
||||
|
||||
expect(component.loadVersionHistory).toHaveBeenCalled();
|
||||
}));
|
||||
|
||||
it('should reload and raise version-deleted DOM event', (done) => {
|
||||
spyOn(component, 'loadVersionHistory').and.stub();
|
||||
fixture.nativeElement.addEventListener('version-deleted', () => {
|
||||
|
Reference in New Issue
Block a user