mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
[ACS-5620] stabilise unit tests by switching to standard Angular api (#8759)
* switch to standard TestBed api for unit testing * test fixes * test fixes * test fixes * test fixes * test fixes * test fixes * test fixes * test fixes * test fixes
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
|
||||
import { TestBed, fakeAsync, tick } from '@angular/core/testing';
|
||||
import { NodeEntry, Node, SitePaging, Site } from '@alfresco/js-api';
|
||||
import { AppConfigService, setupTestBed } from '@alfresco/adf-core';
|
||||
import { AppConfigService } from '@alfresco/adf-core';
|
||||
import { DocumentListService } from '../document-list/services/document-list.service';
|
||||
import { ContentNodeDialogService } from './content-node-dialog.service';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
@@ -69,14 +69,13 @@ describe('ContentNodeDialogService', () => {
|
||||
let spyOnDialogOpen: jasmine.Spy;
|
||||
let afterOpenObservable: Subject<any>;
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ContentTestingModule
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ContentTestingModule
|
||||
]
|
||||
});
|
||||
const appConfig: AppConfigService = TestBed.inject(AppConfigService);
|
||||
appConfig.config.ecmHost = 'http://localhost:9876/ecm';
|
||||
|
||||
|
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing';
|
||||
import { ComponentFixture, fakeAsync, flush, TestBed, tick } from '@angular/core/testing';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import {
|
||||
MinimalNode,
|
||||
@@ -28,7 +28,6 @@ import {
|
||||
SiteEntry,
|
||||
SitePaging
|
||||
} from '@alfresco/js-api';
|
||||
import { setupTestBed } from '@alfresco/adf-core';
|
||||
import { of } from 'rxjs';
|
||||
import { ContentNodeSelectorPanelComponent } from './content-node-selector-panel.component';
|
||||
import { ContentTestingModule } from '../testing/content.testing.module';
|
||||
@@ -83,12 +82,14 @@ describe('ContentNodeSelectorPanelComponent', () => {
|
||||
component.queryBuilderService.executed.next(searchResults);
|
||||
};
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ContentTestingModule
|
||||
],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ContentTestingModule
|
||||
],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
});
|
||||
});
|
||||
|
||||
describe('General component features', () => {
|
||||
@@ -518,6 +519,7 @@ describe('ContentNodeSelectorPanelComponent', () => {
|
||||
expect(searchSpy.calls.count()).toBe(1, 'no other search has been performed');
|
||||
expect(component.clearSearch).toHaveBeenCalled();
|
||||
expect(component.folderIdToShow).toBe('cat-girl-nuku-nuku', 'back to the folder in which the search was performed');
|
||||
flush();
|
||||
}));
|
||||
|
||||
it('should folderIdToShow equal the folder node id when navigation changes', async () => {
|
||||
@@ -692,6 +694,7 @@ describe('ContentNodeSelectorPanelComponent', () => {
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(component.folderIdToShow).toBe('cat-girl-nuku-nuku');
|
||||
flush();
|
||||
}));
|
||||
|
||||
it('should set the folderIdToShow to the default "currentFolderId" if siteId is undefined', (done) => {
|
||||
|
@@ -30,7 +30,6 @@ import {
|
||||
} from '@alfresco/js-api';
|
||||
import {
|
||||
AppConfigService,
|
||||
setupTestBed,
|
||||
DataRow,
|
||||
ThumbnailService,
|
||||
DataColumn
|
||||
@@ -90,12 +89,14 @@ describe('ContentNodeSelectorPanelComponent', () => {
|
||||
component.queryBuilderService.executed.next(searchResults);
|
||||
};
|
||||
|
||||
setupTestBed({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ContentTestingModule
|
||||
],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
TranslateModule.forRoot(),
|
||||
ContentTestingModule
|
||||
],
|
||||
schemas: [CUSTOM_ELEMENTS_SCHEMA]
|
||||
});
|
||||
});
|
||||
|
||||
describe('General component features', () => {
|
||||
|
@@ -18,20 +18,19 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { NameLocationCellComponent } from './name-location-cell.component';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { DataRow, setupTestBed } from '@alfresco/adf-core';
|
||||
import { DataRow } from '@alfresco/adf-core';
|
||||
|
||||
describe('NameLocationCellComponent', () => {
|
||||
let component: NameLocationCellComponent;
|
||||
let fixture: ComponentFixture<NameLocationCellComponent>;
|
||||
let rowData: DataRow;
|
||||
|
||||
setupTestBed({
|
||||
declarations: [
|
||||
NameLocationCellComponent
|
||||
]
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [
|
||||
NameLocationCellComponent
|
||||
]
|
||||
});
|
||||
fixture = TestBed.createComponent(NameLocationCellComponent);
|
||||
component = fixture.componentInstance;
|
||||
|
||||
|
Reference in New Issue
Block a user