mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-10-08 14:51:32 +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
@@ -15,55 +15,34 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { async, TestBed } from '@angular/core/testing';
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { ComponentFixture } from '@angular/core/testing';
|
||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
|
||||
import { BrowserDynamicTestingModule } from '@angular/platform-browser-dynamic/testing';
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
|
||||
import { ShareDialogComponent } from './share.dialog';
|
||||
import { ContentTestingModule } from '../testing/content.testing.module';
|
||||
import { setupTestBed } from '@alfresco/adf-core';
|
||||
|
||||
describe('ShareDialogComponent', () => {
|
||||
|
||||
let fixture: ComponentFixture<ShareDialogComponent>;
|
||||
let component: ShareDialogComponent;
|
||||
let dialogRef;
|
||||
const dialogRef = {
|
||||
close: jasmine.createSpy('close')
|
||||
};
|
||||
|
||||
let data: any = {
|
||||
node: { entry: { properties: { 'qshare:sharedId': 'example-link' }, name: 'example-name' } }
|
||||
node: { entry: { properties: { 'qshare:sharedId': 'example-link' }, name: 'example-name' } },
|
||||
baseShareUrl: 'baseShareUrl-example'
|
||||
};
|
||||
|
||||
beforeEach(async(() => {
|
||||
dialogRef = {
|
||||
close: jasmine.createSpy('close')
|
||||
};
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
FormsModule,
|
||||
ReactiveFormsModule,
|
||||
BrowserDynamicTestingModule
|
||||
],
|
||||
declarations: [
|
||||
ShareDialogComponent
|
||||
],
|
||||
providers: [
|
||||
{ provide: MatDialogRef, useValue: dialogRef },
|
||||
{
|
||||
provide: MAT_DIALOG_DATA,
|
||||
useValue: data
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
TestBed.overrideModule(BrowserDynamicTestingModule, {
|
||||
set: { entryComponents: [ShareDialogComponent] }
|
||||
});
|
||||
|
||||
TestBed.compileComponents();
|
||||
}));
|
||||
setupTestBed({
|
||||
imports: [ContentTestingModule],
|
||||
providers: [
|
||||
{ provide: MatDialogRef, useValue: dialogRef },
|
||||
{ provide: MAT_DIALOG_DATA, useValue: data }
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ShareDialogComponent);
|
||||
@@ -79,7 +58,7 @@ describe('ShareDialogComponent', () => {
|
||||
|
||||
describe('public link creation', () => {
|
||||
|
||||
it('should not create the public link if it alredy present in the node', () => {
|
||||
it('should not create the public link if it already present in the node', () => {
|
||||
let spyCreate = spyOn(component, 'createSharedLinks').and.returnValue(Observable.of(''));
|
||||
|
||||
component.ngOnInit();
|
||||
@@ -87,16 +66,16 @@ describe('ShareDialogComponent', () => {
|
||||
expect(spyCreate).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should not create the public link if it alredy present in the node', () => {
|
||||
it('should not create the public link if it already present in the node', () => {
|
||||
component.data = {
|
||||
node: { entry: { name: 'example-name' } }
|
||||
node: { entry: { name: 'example-name' } },
|
||||
baseShareUrl: 'baseShareUrl-example'
|
||||
};
|
||||
|
||||
let spyCreate = spyOn(component, 'createSharedLinks').and.returnValue(Observable.of(''));
|
||||
|
||||
data = {
|
||||
node: { entry: { name: 'example-name' } }
|
||||
node: { entry: { name: 'example-name' } },
|
||||
baseShareUrl: 'baseShareUrl-example'
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user