mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +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,36 +16,22 @@
|
||||
*/
|
||||
|
||||
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
import { async, TestBed } from '@angular/core/testing';
|
||||
import { DataTableModule } from '@alfresco/adf-core';
|
||||
import { DocumentListService } from '../../services/document-list.service';
|
||||
import { CustomResourcesService } from '../../services/custom-resources.service';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { setupTestBed } from '@alfresco/adf-core';
|
||||
import { ContentActionModel } from './../../models/content-action.model';
|
||||
import { DocumentListComponent } from './../document-list.component';
|
||||
import { ContentActionListComponent } from './content-action-list.component';
|
||||
import { ContentTestingModule } from '../../../testing/content.testing.module';
|
||||
|
||||
describe('ContentColumnList', () => {
|
||||
|
||||
let documentList: DocumentListComponent;
|
||||
let actionList: ContentActionListComponent;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
DataTableModule
|
||||
],
|
||||
declarations: [
|
||||
DocumentListComponent
|
||||
],
|
||||
providers: [
|
||||
DocumentListService,
|
||||
CustomResourcesService
|
||||
],
|
||||
schemas: [
|
||||
CUSTOM_ELEMENTS_SCHEMA
|
||||
]
|
||||
}).compileComponents();
|
||||
}));
|
||||
setupTestBed({
|
||||
imports: [ContentTestingModule],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
documentList = (TestBed.createComponent(DocumentListComponent).componentInstance as DocumentListComponent);
|
||||
|
@@ -18,11 +18,8 @@
|
||||
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
import { EventEmitter } from '@angular/core';
|
||||
import { async, TestBed } from '@angular/core/testing';
|
||||
import { ContentService } from '@alfresco/adf-core';
|
||||
import { DataTableModule } from '@alfresco/adf-core';
|
||||
import { ContentService, setupTestBed } from '@alfresco/adf-core';
|
||||
import { FileNode } from '../../../mock';
|
||||
import { DocumentListService } from '../../services/document-list.service';
|
||||
import { CustomResourcesService } from '../../services/custom-resources.service';
|
||||
import { ContentActionHandler } from './../../models/content-action.model';
|
||||
import { DocumentActionsService } from './../../services/document-actions.service';
|
||||
import { FolderActionsService } from './../../services/folder-actions.service';
|
||||
@@ -31,6 +28,7 @@ import { DocumentListComponent } from './../document-list.component';
|
||||
import { ContentActionListComponent } from './content-action-list.component';
|
||||
import { ContentActionComponent } from './content-action.component';
|
||||
import { ContentActionModel } from './../../models/content-action.model';
|
||||
import { ContentTestingModule } from '../../../testing/content.testing.module';
|
||||
|
||||
describe('ContentAction', () => {
|
||||
|
||||
@@ -42,23 +40,10 @@ describe('ContentAction', () => {
|
||||
let contentService: ContentService;
|
||||
let nodeActionsService: NodeActionsService;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
DataTableModule
|
||||
],
|
||||
providers: [
|
||||
DocumentListService,
|
||||
CustomResourcesService
|
||||
],
|
||||
declarations: [
|
||||
DocumentListComponent
|
||||
],
|
||||
schemas: [
|
||||
CUSTOM_ELEMENTS_SCHEMA
|
||||
]
|
||||
}).compileComponents();
|
||||
}));
|
||||
setupTestBed({
|
||||
imports: [ContentTestingModule],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
contentService = TestBed.get(ContentService);
|
||||
|
@@ -16,14 +16,12 @@
|
||||
*/
|
||||
|
||||
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
import { async, TestBed } from '@angular/core/testing';
|
||||
import { DataColumn, DataTableModule } from '@alfresco/adf-core';
|
||||
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { DataColumn, setupTestBed } from '@alfresco/adf-core';
|
||||
import { LogService } from '@alfresco/adf-core';
|
||||
import { DocumentListService } from '../../services/document-list.service';
|
||||
import { CustomResourcesService } from '../../services/custom-resources.service';
|
||||
import { DocumentListComponent } from './../document-list.component';
|
||||
import { ContentColumnListComponent } from './content-column-list.component';
|
||||
import { ContentTestingModule } from '../../../testing/content.testing.module';
|
||||
|
||||
describe('ContentColumnList', () => {
|
||||
|
||||
@@ -31,23 +29,10 @@ describe('ContentColumnList', () => {
|
||||
let columnList: ContentColumnListComponent;
|
||||
let logService: LogService;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
DataTableModule
|
||||
],
|
||||
declarations: [
|
||||
DocumentListComponent
|
||||
],
|
||||
providers: [
|
||||
CustomResourcesService,
|
||||
DocumentListService
|
||||
],
|
||||
schemas: [
|
||||
CUSTOM_ELEMENTS_SCHEMA
|
||||
]
|
||||
}).compileComponents();
|
||||
}));
|
||||
setupTestBed({
|
||||
imports: [ContentTestingModule],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
documentList = (TestBed.createComponent(DocumentListComponent).componentInstance as DocumentListComponent);
|
||||
|
@@ -16,14 +16,12 @@
|
||||
*/
|
||||
|
||||
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
import { async, TestBed } from '@angular/core/testing';
|
||||
import { LogService } from '@alfresco/adf-core';
|
||||
import { DataTableModule } from '@alfresco/adf-core';
|
||||
import { DocumentListService } from '../../services/document-list.service';
|
||||
import { CustomResourcesService } from '../../services/custom-resources.service';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { LogService, setupTestBed } from '@alfresco/adf-core';
|
||||
import { DocumentListComponent } from './../document-list.component';
|
||||
import { ContentColumnListComponent } from './content-column-list.component';
|
||||
import { ContentColumnComponent } from './content-column.component';
|
||||
import { ContentTestingModule } from '../../../testing/content.testing.module';
|
||||
|
||||
describe('ContentColumn', () => {
|
||||
|
||||
@@ -31,24 +29,10 @@ describe('ContentColumn', () => {
|
||||
let columnList: ContentColumnListComponent;
|
||||
let logService: LogService;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
DataTableModule
|
||||
],
|
||||
declarations: [
|
||||
DocumentListComponent
|
||||
],
|
||||
providers: [
|
||||
CustomResourcesService,
|
||||
DocumentListService,
|
||||
LogService
|
||||
],
|
||||
schemas: [
|
||||
CUSTOM_ELEMENTS_SCHEMA
|
||||
]
|
||||
}).compileComponents();
|
||||
}));
|
||||
setupTestBed({
|
||||
imports: [ContentTestingModule],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
documentList = (TestBed.createComponent(DocumentListComponent).componentInstance as DocumentListComponent);
|
||||
|
@@ -15,11 +15,10 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { CUSTOM_ELEMENTS_SCHEMA, NgZone, SimpleChange, TemplateRef } from '@angular/core';
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { AlfrescoApiService, TranslationService } from '@alfresco/adf-core';
|
||||
import { CUSTOM_ELEMENTS_SCHEMA, SimpleChange, TemplateRef } from '@angular/core';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { DataColumn, DataTableComponent } from '@alfresco/adf-core';
|
||||
import { DataTableModule } from '@alfresco/adf-core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { Subject } from 'rxjs/Subject';
|
||||
import { FileNode, FolderNode } from '../../mock';
|
||||
@@ -38,8 +37,8 @@ import { RowFilter } from './../data/row-filter.model';
|
||||
import { DocumentListService } from './../services/document-list.service';
|
||||
import { CustomResourcesService } from './../services/custom-resources.service';
|
||||
import { DocumentListComponent } from './document-list.component';
|
||||
|
||||
declare let jasmine: any;
|
||||
import { setupTestBed } from '@alfresco/adf-core';
|
||||
import { ContentTestingModule } from '../../testing/content.testing.module';
|
||||
|
||||
describe('DocumentList', () => {
|
||||
|
||||
@@ -51,24 +50,10 @@ describe('DocumentList', () => {
|
||||
let element: HTMLElement;
|
||||
let eventMock: any;
|
||||
|
||||
beforeEach(async(() => {
|
||||
let zone = new NgZone({ enableLongStackTrace: false });
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
DataTableModule
|
||||
],
|
||||
declarations: [
|
||||
DocumentListComponent
|
||||
],
|
||||
providers: [
|
||||
DocumentListService,
|
||||
CustomResourcesService,
|
||||
{ provide: NgZone, useValue: zone }
|
||||
],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
}).compileComponents();
|
||||
}));
|
||||
setupTestBed({
|
||||
imports: [ContentTestingModule],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
eventMock = {
|
||||
@@ -78,35 +63,27 @@ describe('DocumentList', () => {
|
||||
|
||||
fixture = TestBed.createComponent(DocumentListComponent);
|
||||
|
||||
let translateService = TestBed.get(TranslationService);
|
||||
spyOn(translateService, 'get').and.callFake((key) => {
|
||||
return Observable.of(key);
|
||||
});
|
||||
|
||||
element = fixture.nativeElement;
|
||||
documentList = fixture.componentInstance;
|
||||
documentListService = TestBed.get(DocumentListService);
|
||||
apiService = TestBed.get(AlfrescoApiService);
|
||||
customResourcesService = TestBed.get(CustomResourcesService);
|
||||
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
jasmine.Ajax.install();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
jasmine.Ajax.uninstall();
|
||||
fixture.destroy();
|
||||
});
|
||||
|
||||
it('should setup default columns', () => {
|
||||
fixture.detectChanges();
|
||||
documentList.ngAfterContentInit();
|
||||
|
||||
expect(documentList.data.getColumns().length).not.toBe(0);
|
||||
});
|
||||
|
||||
it('should add the custom columns', () => {
|
||||
fixture.detectChanges();
|
||||
|
||||
let column = <DataColumn> {
|
||||
title: 'title',
|
||||
key: 'source',
|
||||
@@ -178,41 +155,29 @@ describe('DocumentList', () => {
|
||||
expect(action.execute).toHaveBeenCalledWith(node);
|
||||
});
|
||||
|
||||
it('should show the loading state during the loading of new elements', (done) => {
|
||||
it('should show the loading state during the loading of new elements', () => {
|
||||
documentList.ngOnInit();
|
||||
documentList.ngAfterContentInit();
|
||||
documentList.node = new NodePaging();
|
||||
|
||||
fixture.detectChanges();
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
expect(element.querySelector('.adf-document-list-loading')).toBeDefined();
|
||||
done();
|
||||
});
|
||||
expect(element.querySelector('.adf-document-list-loading')).toBeDefined();
|
||||
});
|
||||
|
||||
it('should hide the header if showHeader is false', (done) => {
|
||||
it('should hide the header if showHeader is false', () => {
|
||||
documentList.showHeader = false;
|
||||
|
||||
fixture.detectChanges();
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
expect(element.querySelector('.adf-datatable-header')).toBe(null);
|
||||
done();
|
||||
});
|
||||
expect(element.querySelector('.adf-datatable-header')).toBe(null);
|
||||
});
|
||||
|
||||
it('should show the header if showHeader is true', (done) => {
|
||||
it('should show the header if showHeader is true', () => {
|
||||
documentList.showHeader = true;
|
||||
|
||||
fixture.detectChanges();
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
expect(element.querySelector('.adf-datatable-header')).toBeDefined();
|
||||
done();
|
||||
});
|
||||
expect(element.querySelector('.adf-datatable-header')).toBeDefined();
|
||||
});
|
||||
|
||||
it('should reset selection upon reload', () => {
|
||||
@@ -224,29 +189,21 @@ describe('DocumentList', () => {
|
||||
expect(documentList.resetSelection).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should use the cardview style if cardview is true', (done) => {
|
||||
it('should use the cardview style if cardview is true', () => {
|
||||
documentList.display = 'gallery';
|
||||
|
||||
fixture.detectChanges();
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
expect(element.querySelector('.adf-data-table-card')).toBeDefined();
|
||||
done();
|
||||
});
|
||||
expect(element.querySelector('.adf-data-table-card')).toBeDefined();
|
||||
});
|
||||
|
||||
it('should use the base document list style if cardview is false', (done) => {
|
||||
it('should use the base document list style if cardview is false', () => {
|
||||
documentList.display = 'list';
|
||||
|
||||
fixture.detectChanges();
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
fixture.detectChanges();
|
||||
expect(element.querySelector('.adf-data-table-card')).toBe(null);
|
||||
expect(element.querySelector('.adf-data-table')).toBeDefined();
|
||||
done();
|
||||
});
|
||||
expect(element.querySelector('.adf-data-table-card')).toBe(null);
|
||||
expect(element.querySelector('.adf-data-table')).toBeDefined();
|
||||
});
|
||||
|
||||
it('should reset selection upon reload', () => {
|
||||
@@ -258,7 +215,7 @@ describe('DocumentList', () => {
|
||||
expect(documentList.resetSelection).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should reset when a prameter changes', () => {
|
||||
it('should reset when a parameter changes', () => {
|
||||
spyOn(documentList.dataTable, 'resetSelection').and.callThrough();
|
||||
|
||||
documentList.ngOnChanges({});
|
||||
@@ -266,25 +223,18 @@ describe('DocumentList', () => {
|
||||
});
|
||||
|
||||
it('should empty template be present when no element are present', (done) => {
|
||||
documentList.currentFolderId = '1d26e465-dea3-42f3-b415-faa8364b9692';
|
||||
fixture.detectChanges();
|
||||
documentList.folderNode = new NodeMinimal();
|
||||
documentList.folderNode.id = '1d26e465-dea3-42f3-b415-faa8364b9692';
|
||||
|
||||
documentList.reload();
|
||||
|
||||
fixture.detectChanges();
|
||||
spyOn(documentListService, 'getFolder').and.returnValue(Observable.of(fakeNodeAnswerWithNOEntries));
|
||||
|
||||
documentList.ready.subscribe(() => {
|
||||
fixture.detectChanges();
|
||||
expect(element.querySelector('#adf-document-list-empty')).toBeDefined();
|
||||
done();
|
||||
});
|
||||
|
||||
jasmine.Ajax.requests.at(0).respondWith({
|
||||
status: 200,
|
||||
contentType: 'application/json',
|
||||
responseText: JSON.stringify(fakeNodeAnswerWithNOEntries)
|
||||
});
|
||||
documentList.reload();
|
||||
});
|
||||
|
||||
it('should not execute action without node provided', () => {
|
||||
@@ -674,6 +624,8 @@ describe('DocumentList', () => {
|
||||
let folder = new FolderNode();
|
||||
let file = new FileNode();
|
||||
|
||||
spyOn(documentList, 'loadFolder').and.stub();
|
||||
|
||||
expect(documentList.performNavigation(folder)).toBeTruthy();
|
||||
expect(documentList.performNavigation(file)).toBeFalsy();
|
||||
expect(documentList.performNavigation(null)).toBeFalsy();
|
||||
@@ -719,7 +671,7 @@ describe('DocumentList', () => {
|
||||
|
||||
it('should display folder content from loadFolderByNodeId on reload if currentFolderId defined', () => {
|
||||
documentList.currentFolderId = 'id-folder';
|
||||
spyOn(documentList, 'loadFolderByNodeId').and.callThrough();
|
||||
spyOn(documentList, 'loadFolderByNodeId').and.stub();
|
||||
documentList.reload();
|
||||
expect(documentList.loadFolderByNodeId).toHaveBeenCalled();
|
||||
});
|
||||
@@ -833,6 +785,7 @@ describe('DocumentList', () => {
|
||||
});
|
||||
|
||||
it('should set row filter and reload contents if currentFolderId is set when setting rowFilter', () => {
|
||||
fixture.detectChanges();
|
||||
let filter = <RowFilter> {};
|
||||
documentList.currentFolderId = 'id';
|
||||
spyOn(documentList.data, 'setFilter').and.callThrough();
|
||||
@@ -854,6 +807,7 @@ describe('DocumentList', () => {
|
||||
});
|
||||
|
||||
it('should set image resolver for underlying adapter', () => {
|
||||
fixture.detectChanges();
|
||||
let resolver = <ImageResolver> {};
|
||||
spyOn(documentList.data, 'setImageResolver').and.callThrough();
|
||||
|
||||
@@ -933,7 +887,7 @@ describe('DocumentList', () => {
|
||||
documentList.loadFolderByNodeId('123');
|
||||
});
|
||||
|
||||
it('should set no permision when getFolderNode fails with 403', (done) => {
|
||||
it('should set no permission when getFolderNode fails with 403', (done) => {
|
||||
const error = { message: '{ "error": { "statusCode": 403 } }' };
|
||||
spyOn(documentListService, 'getFolderNode').and.returnValue(Observable.throw(error));
|
||||
|
||||
@@ -957,6 +911,7 @@ describe('DocumentList', () => {
|
||||
});
|
||||
|
||||
it('should reload contents if node data changes after previously got noPermission error', () => {
|
||||
fixture.detectChanges();
|
||||
spyOn(documentList.data, 'loadPage').and.callThrough();
|
||||
|
||||
documentList.noPermission = true;
|
||||
@@ -968,7 +923,7 @@ describe('DocumentList', () => {
|
||||
expect(documentList.noPermission).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should noPermission be true if navigate to a folder with no permission', (done) => {
|
||||
it('should noPermission be true if navigate to a folder with no permission', () => {
|
||||
const error = { message: '{ "error": { "statusCode": 403 } }' };
|
||||
|
||||
documentList.currentFolderId = '1d26e465-dea3-42f3-b415-faa8364b9692';
|
||||
@@ -981,12 +936,8 @@ describe('DocumentList', () => {
|
||||
documentList.loadFolder();
|
||||
let clickedFolderNode = new FolderNode('fake-folder-node');
|
||||
documentList.onNodeDblClick(clickedFolderNode);
|
||||
fixture.detectChanges();
|
||||
|
||||
fixture.whenStable().then(() => {
|
||||
expect(documentList.noPermission).toBeTruthy();
|
||||
done();
|
||||
});
|
||||
expect(documentList.noPermission).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should not perform navigation for virtual sources', () => {
|
||||
@@ -1061,6 +1012,7 @@ describe('DocumentList', () => {
|
||||
});
|
||||
|
||||
it('should assure that sites have name property set', (done) => {
|
||||
fixture.detectChanges();
|
||||
const sitesApi = apiService.getInstance().core.sitesApi;
|
||||
spyOn(sitesApi, 'getSites').and.returnValue(Promise.resolve(fakeGetSitesAnswer));
|
||||
|
||||
@@ -1075,6 +1027,7 @@ describe('DocumentList', () => {
|
||||
});
|
||||
|
||||
it('should assure that sites have name property set correctly', (done) => {
|
||||
fixture.detectChanges();
|
||||
const sitesApi = apiService.getInstance().core.sitesApi;
|
||||
spyOn(sitesApi, 'getSites').and.returnValue(Promise.resolve(fakeGetSitesAnswer));
|
||||
|
||||
@@ -1109,6 +1062,7 @@ describe('DocumentList', () => {
|
||||
});
|
||||
|
||||
it('should assure that user membership sites have name property set', (done) => {
|
||||
fixture.detectChanges();
|
||||
const peopleApi = apiService.getInstance().core.peopleApi;
|
||||
spyOn(peopleApi, 'getSiteMembership').and.returnValue(Promise.resolve(fakeGetSiteMembership));
|
||||
|
||||
@@ -1123,6 +1077,7 @@ describe('DocumentList', () => {
|
||||
});
|
||||
|
||||
it('should assure that user membership sites have name property set correctly', (done) => {
|
||||
fixture.detectChanges();
|
||||
const peopleApi = apiService.getInstance().core.peopleApi;
|
||||
spyOn(peopleApi, 'getSiteMembership').and.returnValue(Promise.resolve(fakeGetSiteMembership));
|
||||
|
||||
@@ -1267,9 +1222,10 @@ describe('DocumentList', () => {
|
||||
});
|
||||
|
||||
it('should add includeFields in the server request when present', () => {
|
||||
fixture.detectChanges();
|
||||
documentList.currentFolderId = 'fake-id';
|
||||
documentList.includeFields = ['test-include'];
|
||||
spyOn(documentListService, 'getFolder');
|
||||
spyOn(documentListService, 'getFolder').and.stub();
|
||||
|
||||
documentList.ngOnChanges({ rowFilter: new SimpleChange(null, <RowFilter> {}, true) });
|
||||
|
||||
|
@@ -16,36 +16,21 @@
|
||||
*/
|
||||
|
||||
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
import { async, TestBed } from '@angular/core/testing';
|
||||
import { DataTableComponent, DataTableModule } from '@alfresco/adf-core';
|
||||
import { DocumentListService } from '../../services/document-list.service';
|
||||
import { CustomResourcesService } from '../../services/custom-resources.service';
|
||||
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { DataTableComponent, setupTestBed } from '@alfresco/adf-core';
|
||||
import { DocumentListComponent } from './../document-list.component';
|
||||
import { EmptyFolderContentDirective } from './empty-folder-content.directive';
|
||||
import { ContentTestingModule } from '../../../testing/content.testing.module';
|
||||
|
||||
describe('EmptyFolderContent', () => {
|
||||
|
||||
let emptyFolderContent: EmptyFolderContentDirective;
|
||||
let documentList: DocumentListComponent;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
DataTableModule
|
||||
],
|
||||
declarations: [
|
||||
DocumentListComponent
|
||||
],
|
||||
providers: [
|
||||
DocumentListService,
|
||||
CustomResourcesService
|
||||
],
|
||||
schemas: [
|
||||
CUSTOM_ELEMENTS_SCHEMA
|
||||
]
|
||||
}).compileComponents();
|
||||
}));
|
||||
setupTestBed({
|
||||
imports: [ContentTestingModule],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
documentList = (TestBed.createComponent(DocumentListComponent).componentInstance as DocumentListComponent);
|
||||
|
@@ -15,35 +15,20 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { async, TestBed } from '@angular/core/testing';
|
||||
import { MatProgressSpinnerModule } from '@angular/material';
|
||||
import { DataTableComponent, DataTableModule } from '@alfresco/adf-core';
|
||||
import { DocumentListService } from '../../services/document-list.service';
|
||||
import { CustomResourcesService } from '../../services/custom-resources.service';
|
||||
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { DataTableComponent, setupTestBed } from '@alfresco/adf-core';
|
||||
import { DocumentListComponent } from './../document-list.component';
|
||||
import { NoPermissionContentDirective } from './no-permission-content.directive';
|
||||
import { ContentTestingModule } from '../../../testing/content.testing.module';
|
||||
|
||||
describe('NoPermissionContentDirective', () => {
|
||||
|
||||
let noPermissionContent: NoPermissionContentDirective;
|
||||
let documentList: DocumentListComponent;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
DataTableModule,
|
||||
MatProgressSpinnerModule
|
||||
],
|
||||
declarations: [
|
||||
DocumentListComponent
|
||||
],
|
||||
providers: [
|
||||
DocumentListService,
|
||||
CustomResourcesService
|
||||
]
|
||||
}).compileComponents();
|
||||
}));
|
||||
setupTestBed({
|
||||
imports: [ContentTestingModule]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
documentList = (TestBed.createComponent(DocumentListComponent).componentInstance as DocumentListComponent);
|
||||
|
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { AlfrescoApiServiceMock, AppConfigService, StorageService, ContentService, TranslationMock } from '@alfresco/adf-core';
|
||||
import { AlfrescoApiServiceMock, AppConfigService, StorageService, ContentService, setupTestBed, CoreModule, TranslationMock } from '@alfresco/adf-core';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { FileNode, FolderNode } from '../../mock';
|
||||
import { ContentActionHandler } from '../models/content-action.model';
|
||||
@@ -28,6 +28,12 @@ describe('FolderActionsService', () => {
|
||||
let service: FolderActionsService;
|
||||
let documentListService: DocumentListService;
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
CoreModule.forRoot()
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
let appConfig: AppConfigService = TestBed.get(AppConfigService);
|
||||
appConfig.config.ecmHost = 'http://localhost:9876/ecm';
|
||||
|
@@ -17,14 +17,13 @@
|
||||
|
||||
import { async, TestBed } from '@angular/core/testing';
|
||||
import { MinimalNodeEntryEntity } from 'alfresco-js-api';
|
||||
import { AppConfigService } from '@alfresco/adf-core';
|
||||
import { AppConfigService, setupTestBed, CoreModule } from '@alfresco/adf-core';
|
||||
import { DocumentListService } from './document-list.service';
|
||||
import { NodeActionsService } from './node-actions.service';
|
||||
import { ContentNodeDialogService } from '../../content-node-selector/content-node-dialog.service';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { MatDialogRef } from '@angular/material';
|
||||
import { NodeLockDialogComponent } from '../../dialogs/node-lock.dialog';
|
||||
import { BrowserDynamicTestingModule } from '@angular/platform-browser-dynamic/testing';
|
||||
import { DialogModule } from '../../dialogs/dialog.module';
|
||||
|
||||
const fakeNode: MinimalNodeEntryEntity = <MinimalNodeEntryEntity> {
|
||||
id: 'fake'
|
||||
@@ -39,24 +38,18 @@ describe('NodeActionsService', () => {
|
||||
open: jasmine.createSpy('open')
|
||||
};
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [
|
||||
NodeLockDialogComponent
|
||||
],
|
||||
providers: [
|
||||
NodeActionsService,
|
||||
DocumentListService,
|
||||
ContentNodeDialogService,
|
||||
{ provide: MatDialogRef, useValue: dialogRef }
|
||||
]
|
||||
});
|
||||
|
||||
TestBed.overrideModule(BrowserDynamicTestingModule, {
|
||||
set: { entryComponents: [ NodeLockDialogComponent ] }
|
||||
}).compileComponents();
|
||||
|
||||
}));
|
||||
setupTestBed({
|
||||
imports: [
|
||||
CoreModule.forRoot(),
|
||||
DialogModule
|
||||
],
|
||||
providers: [
|
||||
NodeActionsService,
|
||||
DocumentListService,
|
||||
ContentNodeDialogService,
|
||||
{ provide: MatDialogRef, useValue: dialogRef }
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
let appConfig: AppConfigService = TestBed.get(AppConfigService);
|
Reference in New Issue
Block a user