mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-05-26 17:24:45 +00:00
unit test cleanup (#454)
* auth mock * avoid using jasmine * cleanup preview tests * cleanup recent files tests * cleanup shared files tests * remove fdescribe * update tests * move adf services to single place * move app specific services to single place * cleanup directive tests * cleanup directive tests * update directive tests
This commit is contained in:
parent
e846d97317
commit
ac6e96530f
@ -26,23 +26,11 @@
|
|||||||
import { Component, DebugElement } from '@angular/core';
|
import { Component, DebugElement } from '@angular/core';
|
||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
|
|
||||||
import { Observable } from 'rxjs/Rx';
|
import { Observable } from 'rxjs/Rx';
|
||||||
|
import { NodesApiService, NotificationService } from '@alfresco/adf-core';
|
||||||
import {
|
|
||||||
TranslationService, NodesApiService, NotificationService, AlfrescoApiService, TranslationMock,
|
|
||||||
AppConfigService, StorageService, CookieService, ContentService, AuthenticationService,
|
|
||||||
UserPreferencesService, LogService, ThumbnailService
|
|
||||||
} from '@alfresco/adf-core';
|
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
|
||||||
import { HttpClientModule } from '@angular/common/http';
|
|
||||||
|
|
||||||
import { NodeActionsService } from '../services/node-actions.service';
|
import { NodeActionsService } from '../services/node-actions.service';
|
||||||
import { NodeCopyDirective } from './node-copy.directive';
|
import { NodeCopyDirective } from './node-copy.directive';
|
||||||
import { ContentManagementService } from '../services/content-management.service';
|
import { AppTestingModule } from '../../testing/app-testing.module';
|
||||||
import { MatSnackBarModule, MatDialogModule, MatIconModule } from '@angular/material';
|
|
||||||
import { DocumentListService } from '@alfresco/adf-content-services';
|
|
||||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
template: '<div [acaCopyNode]="selection"></div>'
|
template: '<div [acaCopyNode]="selection"></div>'
|
||||||
@ -58,38 +46,13 @@ describe('NodeCopyDirective', () => {
|
|||||||
let notificationService: NotificationService;
|
let notificationService: NotificationService;
|
||||||
let nodesApiService: NodesApiService;
|
let nodesApiService: NodesApiService;
|
||||||
let service: NodeActionsService;
|
let service: NodeActionsService;
|
||||||
let translationService: TranslationService;
|
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [
|
imports: [ AppTestingModule ],
|
||||||
NoopAnimationsModule,
|
|
||||||
HttpClientModule,
|
|
||||||
TranslateModule.forRoot(),
|
|
||||||
MatSnackBarModule,
|
|
||||||
MatDialogModule,
|
|
||||||
MatIconModule
|
|
||||||
],
|
|
||||||
declarations: [
|
declarations: [
|
||||||
TestComponent,
|
TestComponent,
|
||||||
NodeCopyDirective
|
NodeCopyDirective
|
||||||
],
|
|
||||||
providers: [
|
|
||||||
AlfrescoApiService,
|
|
||||||
AuthenticationService,
|
|
||||||
AppConfigService,
|
|
||||||
StorageService,
|
|
||||||
ContentService,
|
|
||||||
UserPreferencesService,
|
|
||||||
LogService,
|
|
||||||
CookieService,
|
|
||||||
NotificationService,
|
|
||||||
NodesApiService,
|
|
||||||
NodeActionsService,
|
|
||||||
{ provide: TranslationService, useClass: TranslationMock },
|
|
||||||
ContentManagementService,
|
|
||||||
DocumentListService,
|
|
||||||
ThumbnailService
|
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -99,13 +62,6 @@ describe('NodeCopyDirective', () => {
|
|||||||
notificationService = TestBed.get(NotificationService);
|
notificationService = TestBed.get(NotificationService);
|
||||||
nodesApiService = TestBed.get(NodesApiService);
|
nodesApiService = TestBed.get(NodesApiService);
|
||||||
service = TestBed.get(NodeActionsService);
|
service = TestBed.get(NodeActionsService);
|
||||||
translationService = TestBed.get(TranslationService);
|
|
||||||
});
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
spyOn(translationService, 'get').and.callFake((key) => {
|
|
||||||
return Observable.of(key);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Copy node action', () => {
|
describe('Copy node action', () => {
|
||||||
|
@ -25,14 +25,10 @@
|
|||||||
|
|
||||||
import { TestBed, ComponentFixture, fakeAsync, tick } from '@angular/core/testing';
|
import { TestBed, ComponentFixture, fakeAsync, tick } from '@angular/core/testing';
|
||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
import { CoreModule, AlfrescoApiService } from '@alfresco/adf-core';
|
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||||
import { Component, DebugElement } from '@angular/core';
|
import { Component, DebugElement } from '@angular/core';
|
||||||
|
|
||||||
import { NodeDeleteDirective } from './node-delete.directive';
|
import { NodeDeleteDirective } from './node-delete.directive';
|
||||||
import { ContentManagementService } from '../services/content-management.service';
|
|
||||||
import { StoreModule } from '@ngrx/store';
|
|
||||||
import { appReducer } from '../../store/reducers/app.reducer';
|
|
||||||
import { INITIAL_STATE } from '../../store/states/app.state';
|
|
||||||
import { EffectsModule, Actions, ofType } from '@ngrx/effects';
|
import { EffectsModule, Actions, ofType } from '@ngrx/effects';
|
||||||
import { NodeEffects } from '../../store/effects/node.effects';
|
import { NodeEffects } from '../../store/effects/node.effects';
|
||||||
import {
|
import {
|
||||||
@ -40,6 +36,7 @@ import {
|
|||||||
SnackbarErrorAction, SnackbarWarningAction, SNACKBAR_WARNING
|
SnackbarErrorAction, SnackbarWarningAction, SNACKBAR_WARNING
|
||||||
} from '../../store/actions';
|
} from '../../store/actions';
|
||||||
import { map } from 'rxjs/operators';
|
import { map } from 'rxjs/operators';
|
||||||
|
import { AppTestingModule } from '../../testing/app-testing.module';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
template: '<div [acaDeleteNode]="selection"></div>'
|
template: '<div [acaDeleteNode]="selection"></div>'
|
||||||
@ -58,16 +55,12 @@ describe('NodeDeleteDirective', () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [
|
imports: [
|
||||||
CoreModule,
|
AppTestingModule,
|
||||||
StoreModule.forRoot({ app: appReducer }, { initialState: INITIAL_STATE }),
|
|
||||||
EffectsModule.forRoot([NodeEffects])
|
EffectsModule.forRoot([NodeEffects])
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
NodeDeleteDirective,
|
NodeDeleteDirective,
|
||||||
TestComponent
|
TestComponent
|
||||||
],
|
|
||||||
providers: [
|
|
||||||
ContentManagementService
|
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -27,20 +27,14 @@ import { Component, DebugElement } from '@angular/core';
|
|||||||
import { ComponentFixture, TestBed, fakeAsync } from '@angular/core/testing';
|
import { ComponentFixture, TestBed, fakeAsync } from '@angular/core/testing';
|
||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
import { Observable } from 'rxjs/Rx';
|
import { Observable } from 'rxjs/Rx';
|
||||||
import { TranslationService, NodesApiService, NotificationService, CoreModule } from '@alfresco/adf-core';
|
import { NodesApiService, NotificationService, TranslationService } from '@alfresco/adf-core';
|
||||||
import { DocumentListService } from '@alfresco/adf-content-services';
|
|
||||||
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
|
|
||||||
|
|
||||||
import { NodeActionsService } from '../services/node-actions.service';
|
import { NodeActionsService } from '../services/node-actions.service';
|
||||||
import { NodeMoveDirective } from './node-move.directive';
|
import { NodeMoveDirective } from './node-move.directive';
|
||||||
import { ContentManagementService } from '../services/content-management.service';
|
|
||||||
import { StoreModule } from '@ngrx/store';
|
|
||||||
import { EffectsModule, Actions, ofType } from '@ngrx/effects';
|
import { EffectsModule, Actions, ofType } from '@ngrx/effects';
|
||||||
import { appReducer } from '../../store/reducers/app.reducer';
|
|
||||||
import { NodeEffects } from '../../store/effects/node.effects';
|
import { NodeEffects } from '../../store/effects/node.effects';
|
||||||
import { INITIAL_STATE } from '../../store/states/app.state';
|
|
||||||
import { SnackbarErrorAction, SNACKBAR_ERROR } from '../../store/actions';
|
import { SnackbarErrorAction, SNACKBAR_ERROR } from '../../store/actions';
|
||||||
import { map } from 'rxjs/operators';
|
import { map } from 'rxjs/operators';
|
||||||
|
import { AppTestingModule } from '../../testing/app-testing.module';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
template: '<div [acaMoveNode]="selection"></div>'
|
template: '<div [acaMoveNode]="selection"></div>'
|
||||||
@ -56,28 +50,23 @@ describe('NodeMoveDirective', () => {
|
|||||||
let notificationService: NotificationService;
|
let notificationService: NotificationService;
|
||||||
let nodesApiService: NodesApiService;
|
let nodesApiService: NodesApiService;
|
||||||
let service: NodeActionsService;
|
let service: NodeActionsService;
|
||||||
let translationService: TranslationService;
|
|
||||||
let actions$: Actions;
|
let actions$: Actions;
|
||||||
|
let translationService: TranslationService;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [
|
imports: [
|
||||||
BrowserAnimationsModule,
|
AppTestingModule,
|
||||||
CoreModule,
|
|
||||||
StoreModule.forRoot({ app: appReducer }, { initialState: INITIAL_STATE }),
|
|
||||||
EffectsModule.forRoot([NodeEffects])
|
EffectsModule.forRoot([NodeEffects])
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
NodeMoveDirective,
|
NodeMoveDirective,
|
||||||
TestComponent
|
TestComponent
|
||||||
],
|
|
||||||
providers: [
|
|
||||||
DocumentListService,
|
|
||||||
ContentManagementService,
|
|
||||||
NodeActionsService
|
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
translationService = TestBed.get(TranslationService);
|
||||||
|
|
||||||
actions$ = TestBed.get(Actions);
|
actions$ = TestBed.get(Actions);
|
||||||
fixture = TestBed.createComponent(TestComponent);
|
fixture = TestBed.createComponent(TestComponent);
|
||||||
component = fixture.componentInstance;
|
component = fixture.componentInstance;
|
||||||
@ -85,19 +74,18 @@ describe('NodeMoveDirective', () => {
|
|||||||
notificationService = TestBed.get(NotificationService);
|
notificationService = TestBed.get(NotificationService);
|
||||||
nodesApiService = TestBed.get(NodesApiService);
|
nodesApiService = TestBed.get(NodesApiService);
|
||||||
service = TestBed.get(NodeActionsService);
|
service = TestBed.get(NodeActionsService);
|
||||||
translationService = TestBed.get(TranslationService);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
spyOn(translationService, 'get').and.callFake((keysArray) => {
|
spyOn(translationService, 'instant').and.callFake((keysArray) => {
|
||||||
if (Array.isArray(keysArray)) {
|
if (Array.isArray(keysArray)) {
|
||||||
const processedKeys = {};
|
const processedKeys = {};
|
||||||
keysArray.forEach((key) => {
|
keysArray.forEach((key) => {
|
||||||
processedKeys[key] = key;
|
processedKeys[key] = key;
|
||||||
});
|
});
|
||||||
return Observable.of(processedKeys);
|
return processedKeys;
|
||||||
} else {
|
} else {
|
||||||
return Observable.of(keysArray);
|
return keysArray;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -123,7 +123,7 @@ export class NodeMoveDirective {
|
|||||||
errorMessage = this.getErrorMessage(info);
|
errorMessage = this.getErrorMessage(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
const undo = (succeeded + partiallySucceeded > 0) ? this.translation.translate.instant('APP.ACTIONS.UNDO') : '';
|
const undo = (succeeded + partiallySucceeded > 0) ? this.translation.instant('APP.ACTIONS.UNDO') : '';
|
||||||
const withUndo = errorMessage ? '' : '_WITH_UNDO';
|
const withUndo = errorMessage ? '' : '_WITH_UNDO';
|
||||||
failedMessage = errorMessage ? errorMessage : failedMessage;
|
failedMessage = errorMessage ? errorMessage : failedMessage;
|
||||||
|
|
||||||
|
@ -24,17 +24,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, DebugElement } from '@angular/core';
|
import { Component, DebugElement } from '@angular/core';
|
||||||
import { TestBed, ComponentFixture, async, fakeAsync, tick } from '@angular/core/testing';
|
import { TestBed, ComponentFixture, fakeAsync, tick } from '@angular/core/testing';
|
||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
import { Observable } from 'rxjs/Rx';
|
import { Observable } from 'rxjs/Rx';
|
||||||
import { AlfrescoApiService, CoreModule } from '@alfresco/adf-core';
|
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||||
|
|
||||||
import { NodePermanentDeleteDirective } from './node-permanent-delete.directive';
|
import { NodePermanentDeleteDirective } from './node-permanent-delete.directive';
|
||||||
import { MatDialogModule, MatDialog } from '@angular/material';
|
import { MatDialog } from '@angular/material';
|
||||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
|
||||||
import { StoreModule } from '@ngrx/store';
|
|
||||||
import { INITIAL_STATE } from '../../store/states/app.state';
|
|
||||||
import { appReducer } from '../../store/reducers/app.reducer';
|
|
||||||
import { Actions, ofType, EffectsModule } from '@ngrx/effects';
|
import { Actions, ofType, EffectsModule } from '@ngrx/effects';
|
||||||
import {
|
import {
|
||||||
SNACKBAR_INFO, SnackbarWarningAction, SnackbarInfoAction,
|
SNACKBAR_INFO, SnackbarWarningAction, SnackbarInfoAction,
|
||||||
@ -42,7 +38,7 @@ import {
|
|||||||
} from '../../store/actions';
|
} from '../../store/actions';
|
||||||
import { map } from 'rxjs/operators';
|
import { map } from 'rxjs/operators';
|
||||||
import { NodeEffects } from '../../store/effects/node.effects';
|
import { NodeEffects } from '../../store/effects/node.effects';
|
||||||
import { ContentManagementService } from '../services/content-management.service';
|
import { AppTestingModule } from '../../testing/app-testing.module';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
template: `<div [acaPermanentDelete]="selection"></div>`
|
template: `<div [acaPermanentDelete]="selection"></div>`
|
||||||
@ -57,43 +53,30 @@ describe('NodePermanentDeleteDirective', () => {
|
|||||||
let component: TestComponent;
|
let component: TestComponent;
|
||||||
let alfrescoApiService: AlfrescoApiService;
|
let alfrescoApiService: AlfrescoApiService;
|
||||||
let dialog: MatDialog;
|
let dialog: MatDialog;
|
||||||
|
|
||||||
let actions$: Actions;
|
let actions$: Actions;
|
||||||
|
|
||||||
beforeEach(async(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [
|
imports: [
|
||||||
NoopAnimationsModule,
|
AppTestingModule,
|
||||||
CoreModule.forRoot(),
|
|
||||||
MatDialogModule,
|
|
||||||
StoreModule.forRoot({ app: appReducer }, { initialState: INITIAL_STATE }),
|
|
||||||
EffectsModule.forRoot([NodeEffects])
|
EffectsModule.forRoot([NodeEffects])
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
NodePermanentDeleteDirective,
|
NodePermanentDeleteDirective,
|
||||||
TestComponent
|
TestComponent
|
||||||
],
|
|
||||||
providers: [
|
|
||||||
ContentManagementService
|
|
||||||
]
|
]
|
||||||
})
|
|
||||||
.compileComponents()
|
|
||||||
.then(() => {
|
|
||||||
alfrescoApiService = TestBed.get(AlfrescoApiService);
|
|
||||||
alfrescoApiService.reset();
|
|
||||||
|
|
||||||
actions$ = TestBed.get(Actions);
|
|
||||||
|
|
||||||
fixture = TestBed.createComponent(TestComponent);
|
|
||||||
component = fixture.componentInstance;
|
|
||||||
element = fixture.debugElement.query(By.directive(NodePermanentDeleteDirective));
|
|
||||||
|
|
||||||
dialog = TestBed.get(MatDialog);
|
|
||||||
});
|
});
|
||||||
}));
|
|
||||||
|
|
||||||
beforeEach(() => {
|
alfrescoApiService = TestBed.get(AlfrescoApiService);
|
||||||
|
alfrescoApiService.reset();
|
||||||
|
|
||||||
|
actions$ = TestBed.get(Actions);
|
||||||
|
|
||||||
|
fixture = TestBed.createComponent(TestComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
element = fixture.debugElement.query(By.directive(NodePermanentDeleteDirective));
|
||||||
|
|
||||||
|
dialog = TestBed.get(MatDialog);
|
||||||
spyOn(dialog, 'open').and.returnValue({
|
spyOn(dialog, 'open').and.returnValue({
|
||||||
afterClosed() {
|
afterClosed() {
|
||||||
return Observable.of(true);
|
return Observable.of(true);
|
||||||
|
@ -24,24 +24,17 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Component, DebugElement } from '@angular/core';
|
import { Component, DebugElement } from '@angular/core';
|
||||||
import { RouterTestingModule } from '@angular/router/testing';
|
|
||||||
import { TestBed, ComponentFixture, fakeAsync, tick } from '@angular/core/testing';
|
import { TestBed, ComponentFixture, fakeAsync, tick } from '@angular/core/testing';
|
||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
import { Observable } from 'rxjs/Rx';
|
import { AlfrescoApiService } from '@alfresco/adf-core';
|
||||||
|
|
||||||
import { AlfrescoApiService, TranslationService, CoreModule } from '@alfresco/adf-core';
|
|
||||||
|
|
||||||
import { NodeRestoreDirective } from './node-restore.directive';
|
import { NodeRestoreDirective } from './node-restore.directive';
|
||||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
|
||||||
import { ContentManagementService } from '../services/content-management.service';
|
import { ContentManagementService } from '../services/content-management.service';
|
||||||
import { StoreModule } from '@ngrx/store';
|
import { Actions, ofType } from '@ngrx/effects';
|
||||||
import { EffectsModule, Actions, ofType } from '@ngrx/effects';
|
|
||||||
import { appReducer } from '../../store/reducers/app.reducer';
|
|
||||||
import { INITIAL_STATE } from '../../store/states/app.state';
|
|
||||||
import { SnackbarErrorAction,
|
import { SnackbarErrorAction,
|
||||||
SNACKBAR_ERROR, SnackbarInfoAction, SNACKBAR_INFO,
|
SNACKBAR_ERROR, SnackbarInfoAction, SNACKBAR_INFO,
|
||||||
NavigateRouteAction, NAVIGATE_ROUTE } from '../../store/actions';
|
NavigateRouteAction, NAVIGATE_ROUTE } from '../../store/actions';
|
||||||
import { map } from 'rxjs/operators';
|
import { map } from 'rxjs/operators';
|
||||||
|
import { AppTestingModule } from '../../testing/app-testing.module';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
template: `<div [acaRestoreNode]="selection"></div>`
|
template: `<div [acaRestoreNode]="selection"></div>`
|
||||||
@ -55,26 +48,16 @@ describe('NodeRestoreDirective', () => {
|
|||||||
let element: DebugElement;
|
let element: DebugElement;
|
||||||
let component: TestComponent;
|
let component: TestComponent;
|
||||||
let alfrescoService: AlfrescoApiService;
|
let alfrescoService: AlfrescoApiService;
|
||||||
let translation: TranslationService;
|
|
||||||
let directiveInstance: NodeRestoreDirective;
|
let directiveInstance: NodeRestoreDirective;
|
||||||
let contentManagementService: ContentManagementService;
|
let contentManagementService: ContentManagementService;
|
||||||
let actions$: Actions;
|
let actions$: Actions;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [
|
imports: [ AppTestingModule ],
|
||||||
NoopAnimationsModule,
|
|
||||||
RouterTestingModule,
|
|
||||||
CoreModule.forRoot(),
|
|
||||||
StoreModule.forRoot({ app: appReducer }, { initialState: INITIAL_STATE }),
|
|
||||||
EffectsModule.forRoot([])
|
|
||||||
],
|
|
||||||
declarations: [
|
declarations: [
|
||||||
NodeRestoreDirective,
|
NodeRestoreDirective,
|
||||||
TestComponent
|
TestComponent
|
||||||
],
|
|
||||||
providers: [
|
|
||||||
ContentManagementService
|
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -88,9 +71,6 @@ describe('NodeRestoreDirective', () => {
|
|||||||
element = fixture.debugElement.query(By.directive(NodeRestoreDirective));
|
element = fixture.debugElement.query(By.directive(NodeRestoreDirective));
|
||||||
directiveInstance = element.injector.get(NodeRestoreDirective);
|
directiveInstance = element.injector.get(NodeRestoreDirective);
|
||||||
|
|
||||||
translation = TestBed.get(TranslationService);
|
|
||||||
spyOn(translation, 'instant').and.returnValue(Observable.of('message'));
|
|
||||||
|
|
||||||
contentManagementService = TestBed.get(ContentManagementService);
|
contentManagementService = TestBed.get(ContentManagementService);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -26,20 +26,15 @@
|
|||||||
import { Observable } from 'rxjs/Rx';
|
import { Observable } from 'rxjs/Rx';
|
||||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { TestBed, async, ComponentFixture } from '@angular/core/testing';
|
import { TestBed, ComponentFixture } from '@angular/core/testing';
|
||||||
import {
|
import {
|
||||||
NodesApiService, AlfrescoApiService, ContentService,
|
NodesApiService,
|
||||||
UserPreferencesService, LogService, AppConfigService,
|
AlfrescoApiService,
|
||||||
StorageService, CookieService, ThumbnailService,
|
TimeAgoPipe, NodeNameTooltipPipe,
|
||||||
AuthenticationService, TimeAgoPipe, NodeNameTooltipPipe,
|
|
||||||
NodeFavoriteDirective, DataTableComponent, AppConfigPipe
|
NodeFavoriteDirective, DataTableComponent, AppConfigPipe
|
||||||
} from '@alfresco/adf-core';
|
} from '@alfresco/adf-core';
|
||||||
import { DocumentListComponent, CustomResourcesService } from '@alfresco/adf-content-services';
|
import { DocumentListComponent } from '@alfresco/adf-content-services';
|
||||||
|
|
||||||
import { MatMenuModule, MatSnackBarModule, MatIconModule } from '@angular/material';
|
|
||||||
import { DocumentListService } from '@alfresco/adf-content-services';
|
|
||||||
import { ContentManagementService } from '../../common/services/content-management.service';
|
import { ContentManagementService } from '../../common/services/content-management.service';
|
||||||
import { NodePermissionService } from '../../common/services/node-permission.service';
|
|
||||||
|
|
||||||
import { FavoritesComponent } from './favorites.component';
|
import { FavoritesComponent } from './favorites.component';
|
||||||
import { AppTestingModule } from '../../testing/app-testing.module';
|
import { AppTestingModule } from '../../testing/app-testing.module';
|
||||||
@ -80,13 +75,9 @@ describe('FavoritesComponent', () => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(async(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [
|
imports: [ AppTestingModule ],
|
||||||
AppTestingModule,
|
|
||||||
MatMenuModule,
|
|
||||||
MatSnackBarModule, MatIconModule,
|
|
||||||
],
|
|
||||||
declarations: [
|
declarations: [
|
||||||
DataTableComponent,
|
DataTableComponent,
|
||||||
TimeAgoPipe,
|
TimeAgoPipe,
|
||||||
@ -96,36 +87,19 @@ describe('FavoritesComponent', () => {
|
|||||||
FavoritesComponent,
|
FavoritesComponent,
|
||||||
AppConfigPipe
|
AppConfigPipe
|
||||||
],
|
],
|
||||||
providers: [
|
|
||||||
AuthenticationService,
|
|
||||||
UserPreferencesService,
|
|
||||||
AppConfigService, StorageService, CookieService,
|
|
||||||
AlfrescoApiService,
|
|
||||||
CustomResourcesService,
|
|
||||||
LogService,
|
|
||||||
ContentManagementService,
|
|
||||||
ContentService,
|
|
||||||
NodesApiService,
|
|
||||||
NodePermissionService,
|
|
||||||
DocumentListService,
|
|
||||||
ThumbnailService
|
|
||||||
],
|
|
||||||
schemas: [ NO_ERRORS_SCHEMA ]
|
schemas: [ NO_ERRORS_SCHEMA ]
|
||||||
})
|
|
||||||
.compileComponents().then(() => {
|
|
||||||
fixture = TestBed.createComponent(FavoritesComponent);
|
|
||||||
component = fixture.componentInstance;
|
|
||||||
|
|
||||||
nodesApi = TestBed.get(NodesApiService);
|
|
||||||
alfrescoApi = TestBed.get(AlfrescoApiService);
|
|
||||||
alfrescoApi.reset();
|
|
||||||
contentService = TestBed.get(ContentManagementService);
|
|
||||||
router = TestBed.get(Router);
|
|
||||||
});
|
});
|
||||||
}));
|
|
||||||
|
|
||||||
beforeEach(() => {
|
fixture = TestBed.createComponent(FavoritesComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
|
||||||
|
nodesApi = TestBed.get(NodesApiService);
|
||||||
|
alfrescoApi = TestBed.get(AlfrescoApiService);
|
||||||
|
alfrescoApi.reset();
|
||||||
spyOn(alfrescoApi.favoritesApi, 'getFavorites').and.returnValue(Promise.resolve(page));
|
spyOn(alfrescoApi.favoritesApi, 'getFavorites').and.returnValue(Promise.resolve(page));
|
||||||
|
|
||||||
|
contentService = TestBed.get(ContentManagementService);
|
||||||
|
router = TestBed.get(Router);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Events', () => {
|
describe('Events', () => {
|
||||||
|
@ -24,38 +24,25 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { Observable } from 'rxjs/Rx';
|
import { Observable } from 'rxjs/Rx';
|
||||||
import { TestBed, async, fakeAsync, tick } from '@angular/core/testing';
|
import { TestBed, fakeAsync, tick, ComponentFixture } from '@angular/core/testing';
|
||||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
import { Router, ActivatedRoute } from '@angular/router';
|
import { Router, ActivatedRoute } from '@angular/router';
|
||||||
import { RouterTestingModule } from '@angular/router/testing';
|
|
||||||
import { HttpClientModule } from '@angular/common/http';
|
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
|
||||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
|
||||||
import {
|
import {
|
||||||
NotificationService, TranslationService, TranslationMock,
|
NodesApiService,
|
||||||
NodesApiService, AlfrescoApiService, ContentService,
|
|
||||||
UserPreferencesService, LogService, AppConfigService,
|
|
||||||
StorageService, CookieService, ThumbnailService, AuthenticationService,
|
|
||||||
TimeAgoPipe, NodeNameTooltipPipe, FileSizePipe, NodeFavoriteDirective,
|
TimeAgoPipe, NodeNameTooltipPipe, FileSizePipe, NodeFavoriteDirective,
|
||||||
DataTableComponent, UploadService, AppConfigPipe
|
DataTableComponent, UploadService, AppConfigPipe
|
||||||
} from '@alfresco/adf-core';
|
} from '@alfresco/adf-core';
|
||||||
import { DocumentListComponent, CustomResourcesService } from '@alfresco/adf-content-services';
|
import { DocumentListComponent } from '@alfresco/adf-content-services';
|
||||||
import { MatMenuModule, MatSnackBarModule, MatIconModule, MatDialogModule } from '@angular/material';
|
|
||||||
import { DocumentListService } from '@alfresco/adf-content-services';
|
|
||||||
import { ContentManagementService } from '../../common/services/content-management.service';
|
import { ContentManagementService } from '../../common/services/content-management.service';
|
||||||
import { BrowsingFilesService } from '../../common/services/browsing-files.service';
|
import { BrowsingFilesService } from '../../common/services/browsing-files.service';
|
||||||
import { NodeActionsService } from '../../common/services/node-actions.service';
|
import { NodeActionsService } from '../../common/services/node-actions.service';
|
||||||
import { NodePermissionService } from '../../common/services/node-permission.service';
|
|
||||||
|
|
||||||
import { FilesComponent } from './files.component';
|
import { FilesComponent } from './files.component';
|
||||||
import { StoreModule } from '@ngrx/store';
|
import { AppTestingModule } from '../../testing/app-testing.module';
|
||||||
import { appReducer } from '../../store/reducers/app.reducer';
|
|
||||||
import { INITIAL_STATE } from '../../store/states/app.state';
|
|
||||||
|
|
||||||
describe('FilesComponent', () => {
|
describe('FilesComponent', () => {
|
||||||
let node;
|
let node;
|
||||||
let page;
|
let page;
|
||||||
let fixture;
|
let fixture: ComponentFixture<FilesComponent>;
|
||||||
let component: FilesComponent;
|
let component: FilesComponent;
|
||||||
let contentManagementService: ContentManagementService;
|
let contentManagementService: ContentManagementService;
|
||||||
let uploadService: UploadService;
|
let uploadService: UploadService;
|
||||||
@ -64,18 +51,14 @@ describe('FilesComponent', () => {
|
|||||||
let browsingFilesService: BrowsingFilesService;
|
let browsingFilesService: BrowsingFilesService;
|
||||||
let nodeActionsService: NodeActionsService;
|
let nodeActionsService: NodeActionsService;
|
||||||
|
|
||||||
beforeEach(async(() => {
|
beforeAll(() => {
|
||||||
|
// testing only functional-wise not time-wise
|
||||||
|
Observable.prototype.debounceTime = function () { return this; };
|
||||||
|
});
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [
|
imports: [ AppTestingModule ],
|
||||||
MatMenuModule,
|
|
||||||
NoopAnimationsModule,
|
|
||||||
HttpClientModule,
|
|
||||||
TranslateModule.forRoot(),
|
|
||||||
RouterTestingModule,
|
|
||||||
MatSnackBarModule, MatIconModule,
|
|
||||||
MatDialogModule,
|
|
||||||
StoreModule.forRoot({ app: appReducer }, { initialState: INITIAL_STATE })
|
|
||||||
],
|
|
||||||
declarations: [
|
declarations: [
|
||||||
FilesComponent,
|
FilesComponent,
|
||||||
DataTableComponent,
|
DataTableComponent,
|
||||||
@ -90,40 +73,21 @@ describe('FilesComponent', () => {
|
|||||||
{ provide: ActivatedRoute, useValue: {
|
{ provide: ActivatedRoute, useValue: {
|
||||||
snapshot: { data: { preferencePrefix: 'prefix' } },
|
snapshot: { data: { preferencePrefix: 'prefix' } },
|
||||||
params: Observable.of({ folderId: 'someId' })
|
params: Observable.of({ folderId: 'someId' })
|
||||||
} } ,
|
} }
|
||||||
{ provide: TranslationService, useClass: TranslationMock },
|
|
||||||
AuthenticationService,
|
|
||||||
UserPreferencesService,
|
|
||||||
AppConfigService, StorageService, CookieService,
|
|
||||||
AlfrescoApiService,
|
|
||||||
LogService,
|
|
||||||
NotificationService,
|
|
||||||
ContentManagementService,
|
|
||||||
ContentService,
|
|
||||||
NodesApiService,
|
|
||||||
DocumentListService,
|
|
||||||
ThumbnailService,
|
|
||||||
NodeActionsService,
|
|
||||||
NodePermissionService,
|
|
||||||
UploadService,
|
|
||||||
BrowsingFilesService,
|
|
||||||
CustomResourcesService
|
|
||||||
],
|
],
|
||||||
schemas: [ NO_ERRORS_SCHEMA ]
|
schemas: [ NO_ERRORS_SCHEMA ]
|
||||||
}).compileComponents()
|
|
||||||
.then(() => {
|
|
||||||
|
|
||||||
fixture = TestBed.createComponent(FilesComponent);
|
|
||||||
component = fixture.componentInstance;
|
|
||||||
|
|
||||||
contentManagementService = TestBed.get(ContentManagementService);
|
|
||||||
uploadService = TestBed.get(UploadService);
|
|
||||||
nodesApi = TestBed.get(NodesApiService);
|
|
||||||
router = TestBed.get(Router);
|
|
||||||
browsingFilesService = TestBed.get(BrowsingFilesService);
|
|
||||||
nodeActionsService = TestBed.get(NodeActionsService);
|
|
||||||
});
|
});
|
||||||
}));
|
|
||||||
|
fixture = TestBed.createComponent(FilesComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
|
||||||
|
contentManagementService = TestBed.get(ContentManagementService);
|
||||||
|
uploadService = TestBed.get(UploadService);
|
||||||
|
nodesApi = TestBed.get(NodesApiService);
|
||||||
|
router = TestBed.get(Router);
|
||||||
|
browsingFilesService = TestBed.get(BrowsingFilesService);
|
||||||
|
nodeActionsService = TestBed.get(NodeActionsService);
|
||||||
|
});
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
node = { id: 'node-id', isFolder: true };
|
node = { id: 'node-id', isFolder: true };
|
||||||
|
@ -41,16 +41,10 @@ describe('HeaderComponent', () => {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [
|
imports: [ AppTestingModule ],
|
||||||
AppTestingModule
|
|
||||||
],
|
|
||||||
declarations: [
|
declarations: [
|
||||||
HeaderComponent
|
HeaderComponent
|
||||||
],
|
],
|
||||||
providers: [
|
|
||||||
AppConfigService,
|
|
||||||
PeopleContentService
|
|
||||||
],
|
|
||||||
schemas: [ NO_ERRORS_SCHEMA ]
|
schemas: [ NO_ERRORS_SCHEMA ]
|
||||||
})
|
})
|
||||||
.overrideProvider(PeopleContentService, {
|
.overrideProvider(PeopleContentService, {
|
||||||
|
@ -24,23 +24,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
import { RouterTestingModule } from '@angular/router/testing';
|
|
||||||
import { TestBed, ComponentFixture } from '@angular/core/testing';
|
import { TestBed, ComponentFixture } from '@angular/core/testing';
|
||||||
import { MinimalNodeEntryEntity } from 'alfresco-js-api';
|
import { MinimalNodeEntryEntity } from 'alfresco-js-api';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { PeopleContentService, AppConfigService, UserPreferencesService } from '@alfresco/adf-core';
|
||||||
import { HttpClientModule } from '@angular/common/http';
|
|
||||||
import {
|
|
||||||
PeopleContentService, AppConfigService,
|
|
||||||
AuthenticationService, UserPreferencesService, TranslationService,
|
|
||||||
TranslationMock, StorageService, AlfrescoApiService, CookieService,
|
|
||||||
LogService
|
|
||||||
} from '@alfresco/adf-core';
|
|
||||||
import { Observable } from 'rxjs/Observable';
|
import { Observable } from 'rxjs/Observable';
|
||||||
|
|
||||||
import { BrowsingFilesService } from '../../common/services/browsing-files.service';
|
import { BrowsingFilesService } from '../../common/services/browsing-files.service';
|
||||||
import { NodePermissionService } from '../../common/services/node-permission.service';
|
|
||||||
import { LayoutComponent } from './layout.component';
|
import { LayoutComponent } from './layout.component';
|
||||||
import { SidenavViewsManagerDirective } from './sidenav-views-manager.directive';
|
import { SidenavViewsManagerDirective } from './sidenav-views-manager.directive';
|
||||||
|
import { AppTestingModule } from '../../testing/app-testing.module';
|
||||||
|
|
||||||
describe('LayoutComponent', () => {
|
describe('LayoutComponent', () => {
|
||||||
let fixture: ComponentFixture<LayoutComponent>;
|
let fixture: ComponentFixture<LayoutComponent>;
|
||||||
@ -58,26 +49,12 @@ describe('LayoutComponent', () => {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [
|
imports: [ AppTestingModule ],
|
||||||
HttpClientModule,
|
|
||||||
TranslateModule.forRoot(),
|
|
||||||
RouterTestingModule
|
|
||||||
],
|
|
||||||
declarations: [
|
declarations: [
|
||||||
LayoutComponent,
|
LayoutComponent,
|
||||||
SidenavViewsManagerDirective
|
SidenavViewsManagerDirective
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: TranslationService, useClass: TranslationMock },
|
|
||||||
AlfrescoApiService,
|
|
||||||
StorageService,
|
|
||||||
CookieService,
|
|
||||||
LogService,
|
|
||||||
UserPreferencesService,
|
|
||||||
AuthenticationService,
|
|
||||||
AppConfigService,
|
|
||||||
NodePermissionService,
|
|
||||||
BrowsingFilesService,
|
|
||||||
{
|
{
|
||||||
provide: PeopleContentService,
|
provide: PeopleContentService,
|
||||||
useValue: {
|
useValue: {
|
||||||
|
@ -23,34 +23,21 @@
|
|||||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { TestBed, async, ComponentFixture } from '@angular/core/testing';
|
import { TestBed, ComponentFixture } from '@angular/core/testing';
|
||||||
import { Observable } from 'rxjs/Rx';
|
import { Observable } from 'rxjs/Rx';
|
||||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { RouterTestingModule } from '@angular/router/testing';
|
|
||||||
import { HttpClientModule } from '@angular/common/http';
|
|
||||||
import {
|
import {
|
||||||
NotificationService, TranslationService, TranslationMock,
|
NodesApiService, AlfrescoApiService,
|
||||||
NodesApiService, AlfrescoApiService, ContentService,
|
|
||||||
UserPreferencesService, LogService, AppConfigService,
|
|
||||||
StorageService, CookieService, ThumbnailService, AuthenticationService,
|
|
||||||
TimeAgoPipe, NodeNameTooltipPipe, NodeFavoriteDirective, DataTableComponent, AppConfigPipe
|
TimeAgoPipe, NodeNameTooltipPipe, NodeFavoriteDirective, DataTableComponent, AppConfigPipe
|
||||||
} from '@alfresco/adf-core';
|
} from '@alfresco/adf-core';
|
||||||
import { DocumentListComponent, CustomResourcesService } from '@alfresco/adf-content-services';
|
import { DocumentListComponent } from '@alfresco/adf-content-services';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
|
||||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
|
||||||
import { MatMenuModule, MatSnackBarModule, MatIconModule } from '@angular/material';
|
|
||||||
import { DocumentListService } from '@alfresco/adf-content-services';
|
|
||||||
import { ShareDataTableAdapter } from '@alfresco/adf-content-services';
|
import { ShareDataTableAdapter } from '@alfresco/adf-content-services';
|
||||||
|
|
||||||
import { LibrariesComponent } from './libraries.component';
|
import { LibrariesComponent } from './libraries.component';
|
||||||
import { StoreModule } from '@ngrx/store';
|
|
||||||
import { appReducer } from '../../store/reducers/app.reducer';
|
|
||||||
import { INITIAL_STATE } from '../../store/states/app.state';
|
|
||||||
import { ContentManagementService } from '../../common/services/content-management.service';
|
|
||||||
import { ExperimentalDirective } from '../../directives/experimental.directive';
|
import { ExperimentalDirective } from '../../directives/experimental.directive';
|
||||||
|
import { AppTestingModule } from '../../testing/app-testing.module';
|
||||||
|
|
||||||
describe('Libraries Routed Component', () => {
|
describe('LibrariesComponent', () => {
|
||||||
let fixture: ComponentFixture<LibrariesComponent>;
|
let fixture: ComponentFixture<LibrariesComponent>;
|
||||||
let component: LibrariesComponent;
|
let component: LibrariesComponent;
|
||||||
let nodesApi: NodesApiService;
|
let nodesApi: NodesApiService;
|
||||||
@ -75,17 +62,9 @@ describe('Libraries Routed Component', () => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(async(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [
|
imports: [ AppTestingModule ],
|
||||||
MatMenuModule,
|
|
||||||
NoopAnimationsModule,
|
|
||||||
HttpClientModule,
|
|
||||||
TranslateModule.forRoot(),
|
|
||||||
RouterTestingModule,
|
|
||||||
MatSnackBarModule, MatIconModule,
|
|
||||||
StoreModule.forRoot({ app: appReducer }, { initialState: INITIAL_STATE })
|
|
||||||
],
|
|
||||||
declarations: [
|
declarations: [
|
||||||
DataTableComponent,
|
DataTableComponent,
|
||||||
TimeAgoPipe,
|
TimeAgoPipe,
|
||||||
@ -96,36 +75,17 @@ describe('Libraries Routed Component', () => {
|
|||||||
AppConfigPipe,
|
AppConfigPipe,
|
||||||
ExperimentalDirective
|
ExperimentalDirective
|
||||||
],
|
],
|
||||||
providers: [
|
|
||||||
{ provide: TranslationService, useClass: TranslationMock },
|
|
||||||
AuthenticationService,
|
|
||||||
UserPreferencesService,
|
|
||||||
AppConfigService, StorageService, CookieService,
|
|
||||||
AlfrescoApiService,
|
|
||||||
LogService,
|
|
||||||
NotificationService,
|
|
||||||
ContentService,
|
|
||||||
NodesApiService,
|
|
||||||
DocumentListService,
|
|
||||||
ThumbnailService,
|
|
||||||
CustomResourcesService,
|
|
||||||
|
|
||||||
ContentManagementService
|
|
||||||
],
|
|
||||||
schemas: [ NO_ERRORS_SCHEMA ]
|
schemas: [ NO_ERRORS_SCHEMA ]
|
||||||
})
|
|
||||||
.compileComponents().then(() => {
|
|
||||||
fixture = TestBed.createComponent(LibrariesComponent);
|
|
||||||
component = fixture.componentInstance;
|
|
||||||
|
|
||||||
nodesApi = TestBed.get(NodesApiService);
|
|
||||||
alfrescoApi = TestBed.get(AlfrescoApiService);
|
|
||||||
alfrescoApi.reset();
|
|
||||||
router = TestBed.get(Router);
|
|
||||||
});
|
});
|
||||||
}));
|
|
||||||
|
|
||||||
beforeEach(() => {
|
fixture = TestBed.createComponent(LibrariesComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
|
||||||
|
nodesApi = TestBed.get(NodesApiService);
|
||||||
|
alfrescoApi = TestBed.get(AlfrescoApiService);
|
||||||
|
alfrescoApi.reset();
|
||||||
|
router = TestBed.get(Router);
|
||||||
|
|
||||||
spyOn(alfrescoApi.sitesApi, 'getSites').and.returnValue((Promise.resolve(page)));
|
spyOn(alfrescoApi.sitesApi, 'getSites').and.returnValue((Promise.resolve(page)));
|
||||||
spyOn(alfrescoApi.peopleApi, 'getSiteMembership').and.returnValue((Promise.resolve({})));
|
spyOn(alfrescoApi.peopleApi, 'getSiteMembership').and.returnValue((Promise.resolve({})));
|
||||||
});
|
});
|
||||||
|
@ -24,19 +24,12 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
import { RouterTestingModule } from '@angular/router/testing';
|
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { HttpClientModule } from '@angular/common/http';
|
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
|
||||||
import { Location } from '@angular/common';
|
import { Location } from '@angular/common';
|
||||||
import { TestBed, async, ComponentFixture } from '@angular/core/testing';
|
import { TestBed, ComponentFixture } from '@angular/core/testing';
|
||||||
import {
|
import { AuthenticationService, UserPreferencesService, AppConfigPipe } from '@alfresco/adf-core';
|
||||||
AuthenticationService, UserPreferencesService, TranslationService,
|
|
||||||
TranslationMock, AppConfigService, StorageService, AlfrescoApiService,
|
|
||||||
CookieService, LogService, AppConfigPipe
|
|
||||||
} from '@alfresco/adf-core';
|
|
||||||
|
|
||||||
import { LoginComponent } from './login.component';
|
import { LoginComponent } from './login.component';
|
||||||
|
import { AppTestingModule } from '../../testing/app-testing.module';
|
||||||
|
|
||||||
describe('LoginComponent', () => {
|
describe('LoginComponent', () => {
|
||||||
let fixture: ComponentFixture<LoginComponent>;
|
let fixture: ComponentFixture<LoginComponent>;
|
||||||
@ -45,27 +38,15 @@ describe('LoginComponent', () => {
|
|||||||
let auth: AuthenticationService;
|
let auth: AuthenticationService;
|
||||||
let location: Location;
|
let location: Location;
|
||||||
|
|
||||||
beforeEach(async(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [
|
imports: [ AppTestingModule ],
|
||||||
HttpClientModule,
|
|
||||||
TranslateModule.forRoot(),
|
|
||||||
RouterTestingModule
|
|
||||||
],
|
|
||||||
declarations: [
|
declarations: [
|
||||||
LoginComponent,
|
LoginComponent,
|
||||||
AppConfigPipe
|
AppConfigPipe
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: TranslationService, useClass: TranslationMock },
|
Location
|
||||||
Location,
|
|
||||||
CookieService,
|
|
||||||
LogService,
|
|
||||||
StorageService,
|
|
||||||
AlfrescoApiService,
|
|
||||||
AppConfigService,
|
|
||||||
AuthenticationService,
|
|
||||||
UserPreferencesService
|
|
||||||
],
|
],
|
||||||
schemas: [ NO_ERRORS_SCHEMA ]
|
schemas: [ NO_ERRORS_SCHEMA ]
|
||||||
});
|
});
|
||||||
@ -73,16 +54,16 @@ describe('LoginComponent', () => {
|
|||||||
fixture = TestBed.createComponent(LoginComponent);
|
fixture = TestBed.createComponent(LoginComponent);
|
||||||
|
|
||||||
router = TestBed.get(Router);
|
router = TestBed.get(Router);
|
||||||
location = TestBed.get(Location);
|
|
||||||
auth = TestBed.get(AuthenticationService);
|
|
||||||
userPreference = TestBed.get(UserPreferencesService);
|
|
||||||
}));
|
|
||||||
|
|
||||||
beforeEach(() => {
|
|
||||||
spyOn(userPreference, 'setStoragePrefix');
|
|
||||||
spyOn(router, 'navigateByUrl');
|
spyOn(router, 'navigateByUrl');
|
||||||
spyOn(auth, 'getRedirect').and.returnValue('/some-url');
|
|
||||||
|
location = TestBed.get(Location);
|
||||||
spyOn(location, 'forward');
|
spyOn(location, 'forward');
|
||||||
|
|
||||||
|
auth = TestBed.get(AuthenticationService);
|
||||||
|
spyOn(auth, 'getRedirect').and.returnValue('/some-url');
|
||||||
|
|
||||||
|
userPreference = TestBed.get(UserPreferencesService);
|
||||||
|
spyOn(userPreference, 'setStoragePrefix');
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('OnInit()', () => {
|
describe('OnInit()', () => {
|
||||||
|
@ -25,23 +25,13 @@
|
|||||||
|
|
||||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
import { Router, ActivatedRoute } from '@angular/router';
|
import { Router, ActivatedRoute } from '@angular/router';
|
||||||
import { RouterTestingModule } from '@angular/router/testing';
|
|
||||||
import { TestBed, async, ComponentFixture } from '@angular/core/testing';
|
import { TestBed, async, ComponentFixture } from '@angular/core/testing';
|
||||||
import {
|
import { AlfrescoApiService, UserPreferencesService, AppConfigPipe, NodeFavoriteDirective } from '@alfresco/adf-core';
|
||||||
AlfrescoApiService, UserPreferencesService,
|
|
||||||
TranslationService, TranslationMock,
|
|
||||||
CoreModule, UploadService
|
|
||||||
} from '@alfresco/adf-core';
|
|
||||||
|
|
||||||
import { PreviewComponent } from './preview.component';
|
import { PreviewComponent } from './preview.component';
|
||||||
import { Observable } from 'rxjs/Rx';
|
import { Observable } from 'rxjs/Rx';
|
||||||
import { NodePermissionService } from '../../common/services/node-permission.service';
|
|
||||||
import { ContentManagementService } from '../../common/services/content-management.service';
|
|
||||||
import { StoreModule } from '@ngrx/store';
|
|
||||||
import { appReducer } from '../../store/reducers/app.reducer';
|
|
||||||
import { INITIAL_STATE } from '../../store/states/app.state';
|
|
||||||
import { EffectsModule } from '@ngrx/effects';
|
import { EffectsModule } from '@ngrx/effects';
|
||||||
import { NodeEffects } from '../../store/effects/node.effects';
|
import { NodeEffects } from '../../store/effects/node.effects';
|
||||||
|
import { AppTestingModule } from '../../testing/app-testing.module';
|
||||||
|
|
||||||
describe('PreviewComponent', () => {
|
describe('PreviewComponent', () => {
|
||||||
|
|
||||||
@ -55,20 +45,13 @@ describe('PreviewComponent', () => {
|
|||||||
beforeEach(async(() => {
|
beforeEach(async(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [
|
imports: [
|
||||||
RouterTestingModule,
|
AppTestingModule,
|
||||||
CoreModule.forRoot(),
|
|
||||||
StoreModule.forRoot({ app: appReducer }, { initialState: INITIAL_STATE }),
|
|
||||||
EffectsModule.forRoot([NodeEffects])
|
EffectsModule.forRoot([NodeEffects])
|
||||||
],
|
],
|
||||||
providers: [
|
|
||||||
{ provide: TranslationService, useClass: TranslationMock },
|
|
||||||
NodePermissionService,
|
|
||||||
ContentManagementService,
|
|
||||||
UploadService
|
|
||||||
],
|
|
||||||
declarations: [
|
declarations: [
|
||||||
|
AppConfigPipe,
|
||||||
PreviewComponent,
|
PreviewComponent,
|
||||||
// NodeFavoriteDirective
|
NodeFavoriteDirective
|
||||||
],
|
],
|
||||||
schemas: [ NO_ERRORS_SCHEMA ]
|
schemas: [ NO_ERRORS_SCHEMA ]
|
||||||
})
|
})
|
||||||
|
@ -23,31 +23,19 @@
|
|||||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { TestBed, async, ComponentFixture } from '@angular/core/testing';
|
import { TestBed, ComponentFixture } from '@angular/core/testing';
|
||||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
import { RouterTestingModule } from '@angular/router/testing';
|
|
||||||
import { HttpClientModule } from '@angular/common/http';
|
|
||||||
import {
|
import {
|
||||||
NotificationService, TranslationService, TranslationMock,
|
AlfrescoApiService,
|
||||||
NodesApiService, AlfrescoApiService, ContentService, UploadService,
|
|
||||||
UserPreferencesService, LogService, AppConfigService,
|
|
||||||
StorageService, CookieService, ThumbnailService, AuthenticationService,
|
|
||||||
TimeAgoPipe, NodeNameTooltipPipe, NodeFavoriteDirective, DataTableComponent, AppConfigPipe
|
TimeAgoPipe, NodeNameTooltipPipe, NodeFavoriteDirective, DataTableComponent, AppConfigPipe
|
||||||
} from '@alfresco/adf-core';
|
} from '@alfresco/adf-core';
|
||||||
import { DocumentListComponent, CustomResourcesService } from '@alfresco/adf-content-services';
|
import { DocumentListComponent } from '@alfresco/adf-content-services';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
|
||||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
|
||||||
import { MatMenuModule, MatSnackBarModule, MatIconModule } from '@angular/material';
|
|
||||||
import { DocumentListService } from '@alfresco/adf-content-services';
|
|
||||||
import { ContentManagementService } from '../../common/services/content-management.service';
|
import { ContentManagementService } from '../../common/services/content-management.service';
|
||||||
import { NodePermissionService } from '../../common/services/node-permission.service';
|
|
||||||
|
|
||||||
import { RecentFilesComponent } from './recent-files.component';
|
import { RecentFilesComponent } from './recent-files.component';
|
||||||
import { StoreModule } from '@ngrx/store';
|
import { AppTestingModule } from '../../testing/app-testing.module';
|
||||||
import { appReducer } from '../../store/reducers/app.reducer';
|
|
||||||
import { INITIAL_STATE } from '../../store/states/app.state';
|
|
||||||
|
|
||||||
describe('RecentFiles Routed Component', () => {
|
describe('RecentFilesComponent', () => {
|
||||||
let fixture: ComponentFixture<RecentFilesComponent>;
|
let fixture: ComponentFixture<RecentFilesComponent>;
|
||||||
let component: RecentFilesComponent;
|
let component: RecentFilesComponent;
|
||||||
let alfrescoApi: AlfrescoApiService;
|
let alfrescoApi: AlfrescoApiService;
|
||||||
@ -63,16 +51,10 @@ describe('RecentFiles Routed Component', () => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(async(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [
|
imports: [
|
||||||
MatMenuModule,
|
AppTestingModule
|
||||||
NoopAnimationsModule,
|
|
||||||
HttpClientModule,
|
|
||||||
TranslateModule.forRoot(),
|
|
||||||
RouterTestingModule,
|
|
||||||
MatSnackBarModule, MatIconModule,
|
|
||||||
StoreModule.forRoot({ app: appReducer }, { initialState: INITIAL_STATE })
|
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
DataTableComponent,
|
DataTableComponent,
|
||||||
@ -83,41 +65,21 @@ describe('RecentFiles Routed Component', () => {
|
|||||||
RecentFilesComponent,
|
RecentFilesComponent,
|
||||||
AppConfigPipe
|
AppConfigPipe
|
||||||
],
|
],
|
||||||
providers: [
|
|
||||||
{ provide: TranslationService, useClass: TranslationMock },
|
|
||||||
AuthenticationService,
|
|
||||||
UserPreferencesService,
|
|
||||||
AppConfigService, StorageService, CookieService,
|
|
||||||
AlfrescoApiService,
|
|
||||||
LogService,
|
|
||||||
NotificationService,
|
|
||||||
ContentManagementService,
|
|
||||||
NodePermissionService,
|
|
||||||
ContentService,
|
|
||||||
NodesApiService,
|
|
||||||
DocumentListService,
|
|
||||||
ThumbnailService,
|
|
||||||
CustomResourcesService,
|
|
||||||
UploadService
|
|
||||||
],
|
|
||||||
schemas: [ NO_ERRORS_SCHEMA ]
|
schemas: [ NO_ERRORS_SCHEMA ]
|
||||||
})
|
|
||||||
.compileComponents().then(() => {
|
|
||||||
fixture = TestBed.createComponent(RecentFilesComponent);
|
|
||||||
component = fixture.componentInstance;
|
|
||||||
|
|
||||||
contentService = TestBed.get(ContentManagementService);
|
|
||||||
alfrescoApi = TestBed.get(AlfrescoApiService);
|
|
||||||
alfrescoApi.reset();
|
|
||||||
});
|
});
|
||||||
}));
|
|
||||||
|
|
||||||
beforeEach(() => {
|
fixture = TestBed.createComponent(RecentFilesComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
|
||||||
|
contentService = TestBed.get(ContentManagementService);
|
||||||
|
alfrescoApi = TestBed.get(AlfrescoApiService);
|
||||||
|
alfrescoApi.reset();
|
||||||
|
|
||||||
spyOn(alfrescoApi.peopleApi, 'getPerson').and.returnValue(Promise.resolve({
|
spyOn(alfrescoApi.peopleApi, 'getPerson').and.returnValue(Promise.resolve({
|
||||||
entry: { id: 'personId' }
|
entry: { id: 'personId' }
|
||||||
}));
|
}));
|
||||||
|
|
||||||
spyOn(alfrescoApi.searchApi, 'search').and.returnValue(Promise.resolve(page));
|
spyOn(alfrescoApi.searchApi, 'search').and.returnValue(Promise.resolve(page));
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('OnInit()', () => {
|
describe('OnInit()', () => {
|
||||||
|
@ -23,29 +23,16 @@
|
|||||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { TestBed, async, ComponentFixture } from '@angular/core/testing';
|
import { TestBed, ComponentFixture } from '@angular/core/testing';
|
||||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
import { RouterTestingModule } from '@angular/router/testing';
|
|
||||||
import { HttpClientModule } from '@angular/common/http';
|
|
||||||
import {
|
import {
|
||||||
NotificationService, TranslationService, TranslationMock,
|
AlfrescoApiService,
|
||||||
NodesApiService, AlfrescoApiService, ContentService,
|
|
||||||
UserPreferencesService, LogService, AppConfigService, UploadService,
|
|
||||||
StorageService, CookieService, ThumbnailService, AuthenticationService,
|
|
||||||
TimeAgoPipe, NodeNameTooltipPipe, NodeFavoriteDirective, DataTableComponent, AppConfigPipe
|
TimeAgoPipe, NodeNameTooltipPipe, NodeFavoriteDirective, DataTableComponent, AppConfigPipe
|
||||||
} from '@alfresco/adf-core';
|
} from '@alfresco/adf-core';
|
||||||
import { DocumentListComponent, CustomResourcesService } from '@alfresco/adf-content-services';
|
import { DocumentListComponent } from '@alfresco/adf-content-services';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
|
||||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
|
||||||
import { MatMenuModule, MatSnackBarModule, MatIconModule } from '@angular/material';
|
|
||||||
import { DocumentListService } from '@alfresco/adf-content-services';
|
|
||||||
import { ContentManagementService } from '../../common/services/content-management.service';
|
import { ContentManagementService } from '../../common/services/content-management.service';
|
||||||
import { NodePermissionService } from '../../common/services/node-permission.service';
|
|
||||||
|
|
||||||
import { SharedFilesComponent } from './shared-files.component';
|
import { SharedFilesComponent } from './shared-files.component';
|
||||||
import { StoreModule } from '@ngrx/store';
|
import { AppTestingModule } from '../../testing/app-testing.module';
|
||||||
import { appReducer } from '../../store/reducers/app.reducer';
|
|
||||||
import { INITIAL_STATE } from '../../store/states/app.state';
|
|
||||||
|
|
||||||
describe('SharedFilesComponent', () => {
|
describe('SharedFilesComponent', () => {
|
||||||
let fixture: ComponentFixture<SharedFilesComponent>;
|
let fixture: ComponentFixture<SharedFilesComponent>;
|
||||||
@ -63,18 +50,10 @@ describe('SharedFilesComponent', () => {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(async(() => {
|
beforeEach(() => {
|
||||||
TestBed
|
TestBed
|
||||||
.configureTestingModule({
|
.configureTestingModule({
|
||||||
imports: [
|
imports: [ AppTestingModule ],
|
||||||
MatMenuModule,
|
|
||||||
NoopAnimationsModule,
|
|
||||||
HttpClientModule,
|
|
||||||
TranslateModule.forRoot(),
|
|
||||||
RouterTestingModule,
|
|
||||||
MatSnackBarModule, MatIconModule,
|
|
||||||
StoreModule.forRoot({ app: appReducer }, { initialState: INITIAL_STATE })
|
|
||||||
],
|
|
||||||
declarations: [
|
declarations: [
|
||||||
DataTableComponent,
|
DataTableComponent,
|
||||||
TimeAgoPipe,
|
TimeAgoPipe,
|
||||||
@ -84,39 +63,17 @@ describe('SharedFilesComponent', () => {
|
|||||||
SharedFilesComponent,
|
SharedFilesComponent,
|
||||||
AppConfigPipe
|
AppConfigPipe
|
||||||
],
|
],
|
||||||
providers: [
|
|
||||||
{ provide: TranslationService, useClass: TranslationMock },
|
|
||||||
AuthenticationService,
|
|
||||||
UserPreferencesService,
|
|
||||||
AppConfigService, StorageService, CookieService,
|
|
||||||
AlfrescoApiService,
|
|
||||||
LogService,
|
|
||||||
NotificationService,
|
|
||||||
ContentManagementService,
|
|
||||||
NodePermissionService,
|
|
||||||
ContentService,
|
|
||||||
NodesApiService,
|
|
||||||
DocumentListService,
|
|
||||||
ThumbnailService,
|
|
||||||
CustomResourcesService,
|
|
||||||
UploadService
|
|
||||||
],
|
|
||||||
schemas: [ NO_ERRORS_SCHEMA ]
|
schemas: [ NO_ERRORS_SCHEMA ]
|
||||||
})
|
|
||||||
.compileComponents()
|
|
||||||
.then(() => {
|
|
||||||
fixture = TestBed.createComponent(SharedFilesComponent);
|
|
||||||
component = fixture.componentInstance;
|
|
||||||
|
|
||||||
contentService = TestBed.get(ContentManagementService);
|
|
||||||
alfrescoApi = TestBed.get(AlfrescoApiService);
|
|
||||||
alfrescoApi.reset();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}));
|
fixture = TestBed.createComponent(SharedFilesComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
|
||||||
beforeEach(() => {
|
contentService = TestBed.get(ContentManagementService);
|
||||||
spyOn(alfrescoApi.sharedLinksApi, 'findSharedLinks').and.returnValue(Promise.resolve(page));
|
alfrescoApi = TestBed.get(AlfrescoApiService);
|
||||||
|
alfrescoApi.reset();
|
||||||
|
|
||||||
|
spyOn(alfrescoApi.sharedLinksApi, 'findSharedLinks').and.returnValue(Promise.resolve(page));
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('OnInit', () => {
|
describe('OnInit', () => {
|
||||||
|
@ -25,16 +25,12 @@
|
|||||||
|
|
||||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
import { TestBed, async, ComponentFixture } from '@angular/core/testing';
|
import { TestBed, async, ComponentFixture } from '@angular/core/testing';
|
||||||
import { AppConfigService, CoreModule } from '@alfresco/adf-core';
|
import { AppConfigService } from '@alfresco/adf-core';
|
||||||
import { BrowsingFilesService } from '../../common/services/browsing-files.service';
|
import { BrowsingFilesService } from '../../common/services/browsing-files.service';
|
||||||
import { NodePermissionService } from '../../common/services/node-permission.service';
|
|
||||||
|
|
||||||
import { SidenavComponent } from './sidenav.component';
|
import { SidenavComponent } from './sidenav.component';
|
||||||
import { EffectsModule } from '@ngrx/effects';
|
import { EffectsModule } from '@ngrx/effects';
|
||||||
import { NodeEffects } from '../../store/effects/node.effects';
|
import { NodeEffects } from '../../store/effects/node.effects';
|
||||||
import { ContentManagementService } from '../../common/services/content-management.service';
|
|
||||||
import { AppTestingModule } from '../../testing/app-testing.module';
|
import { AppTestingModule } from '../../testing/app-testing.module';
|
||||||
import { MaterialModule } from '../../material.module';
|
|
||||||
|
|
||||||
describe('SidenavComponent', () => {
|
describe('SidenavComponent', () => {
|
||||||
let fixture: ComponentFixture<SidenavComponent>;
|
let fixture: ComponentFixture<SidenavComponent>;
|
||||||
@ -54,18 +50,11 @@ describe('SidenavComponent', () => {
|
|||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [
|
imports: [
|
||||||
AppTestingModule,
|
AppTestingModule,
|
||||||
MaterialModule,
|
|
||||||
CoreModule.forRoot(),
|
|
||||||
EffectsModule.forRoot([NodeEffects])
|
EffectsModule.forRoot([NodeEffects])
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
SidenavComponent
|
SidenavComponent
|
||||||
],
|
],
|
||||||
providers: [
|
|
||||||
NodePermissionService,
|
|
||||||
BrowsingFilesService,
|
|
||||||
ContentManagementService
|
|
||||||
],
|
|
||||||
schemas: [ NO_ERRORS_SCHEMA ]
|
schemas: [ NO_ERRORS_SCHEMA ]
|
||||||
})
|
})
|
||||||
.compileComponents()
|
.compileComponents()
|
||||||
|
@ -25,20 +25,14 @@
|
|||||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||||
import { TestBed, ComponentFixture } from '@angular/core/testing';
|
import { TestBed, ComponentFixture } from '@angular/core/testing';
|
||||||
import {
|
import {
|
||||||
NotificationService,
|
AlfrescoApiService,
|
||||||
NodesApiService, AlfrescoApiService, ContentService,
|
TimeAgoPipe, NodeNameTooltipPipe,
|
||||||
UserPreferencesService, LogService, AppConfigService,
|
NodeFavoriteDirective, DataTableComponent, AppConfigPipe
|
||||||
StorageService, CookieService, ThumbnailService,
|
|
||||||
AuthenticationService, TimeAgoPipe, NodeNameTooltipPipe,
|
|
||||||
NodeFavoriteDirective, DataTableComponent, AppConfigPipe, PeopleContentService
|
|
||||||
} from '@alfresco/adf-core';
|
} from '@alfresco/adf-core';
|
||||||
import { DocumentListComponent, CustomResourcesService } from '@alfresco/adf-content-services';
|
import { DocumentListComponent } from '@alfresco/adf-content-services';
|
||||||
import { DocumentListService } from '@alfresco/adf-content-services';
|
|
||||||
import { ContentManagementService } from '../../common/services/content-management.service';
|
import { ContentManagementService } from '../../common/services/content-management.service';
|
||||||
|
|
||||||
import { TrashcanComponent } from './trashcan.component';
|
import { TrashcanComponent } from './trashcan.component';
|
||||||
import { AppTestingModule } from '../../testing/app-testing.module';
|
import { AppTestingModule } from '../../testing/app-testing.module';
|
||||||
import { MaterialModule } from '../../material.module';
|
|
||||||
|
|
||||||
describe('TrashcanComponent', () => {
|
describe('TrashcanComponent', () => {
|
||||||
let fixture: ComponentFixture<TrashcanComponent>;
|
let fixture: ComponentFixture<TrashcanComponent>;
|
||||||
@ -58,10 +52,7 @@ describe('TrashcanComponent', () => {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [
|
imports: [ AppTestingModule ],
|
||||||
AppTestingModule,
|
|
||||||
MaterialModule,
|
|
||||||
],
|
|
||||||
declarations: [
|
declarations: [
|
||||||
DataTableComponent,
|
DataTableComponent,
|
||||||
TimeAgoPipe,
|
TimeAgoPipe,
|
||||||
@ -71,21 +62,6 @@ describe('TrashcanComponent', () => {
|
|||||||
TrashcanComponent,
|
TrashcanComponent,
|
||||||
AppConfigPipe
|
AppConfigPipe
|
||||||
],
|
],
|
||||||
providers: [
|
|
||||||
AuthenticationService,
|
|
||||||
UserPreferencesService,
|
|
||||||
PeopleContentService,
|
|
||||||
AppConfigService, StorageService, CookieService,
|
|
||||||
AlfrescoApiService,
|
|
||||||
LogService,
|
|
||||||
NotificationService,
|
|
||||||
ContentManagementService,
|
|
||||||
ContentService,
|
|
||||||
NodesApiService,
|
|
||||||
DocumentListService,
|
|
||||||
ThumbnailService,
|
|
||||||
CustomResourcesService
|
|
||||||
],
|
|
||||||
schemas: [ NO_ERRORS_SCHEMA ]
|
schemas: [ NO_ERRORS_SCHEMA ]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -24,10 +24,26 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { TranslatePipe, TranslateService } from '@ngx-translate/core';
|
import { TranslateService, TranslatePipe } from '@ngx-translate/core';
|
||||||
import { TranslatePipeMock } from './translate-pipe.directive';
|
import { TranslatePipeMock } from './translate-pipe.directive';
|
||||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||||
import { TranslationService, TranslationMock } from '@alfresco/adf-core';
|
import {
|
||||||
|
TranslationService,
|
||||||
|
TranslationMock,
|
||||||
|
AuthenticationService,
|
||||||
|
UserPreferencesService,
|
||||||
|
AppConfigService,
|
||||||
|
StorageService,
|
||||||
|
CookieService,
|
||||||
|
AlfrescoApiService,
|
||||||
|
LogService,
|
||||||
|
NotificationService,
|
||||||
|
NodesApiService,
|
||||||
|
ContentService,
|
||||||
|
ThumbnailService,
|
||||||
|
UploadService,
|
||||||
|
PeopleContentService
|
||||||
|
} from '@alfresco/adf-core';
|
||||||
import { HttpClientModule } from '@angular/common/http';
|
import { HttpClientModule } from '@angular/common/http';
|
||||||
import { TranslateServiceMock } from './translation.service';
|
import { TranslateServiceMock } from './translation.service';
|
||||||
import { StoreModule } from '@ngrx/store';
|
import { StoreModule } from '@ngrx/store';
|
||||||
@ -35,26 +51,64 @@ import { appReducer } from '../store/reducers/app.reducer';
|
|||||||
import { INITIAL_STATE } from '../store/states/app.state';
|
import { INITIAL_STATE } from '../store/states/app.state';
|
||||||
import { RouterTestingModule } from '@angular/router/testing';
|
import { RouterTestingModule } from '@angular/router/testing';
|
||||||
import { EffectsModule } from '@ngrx/effects';
|
import { EffectsModule } from '@ngrx/effects';
|
||||||
|
import {
|
||||||
|
CustomResourcesService,
|
||||||
|
DocumentListService
|
||||||
|
} from '@alfresco/adf-content-services';
|
||||||
|
import { MaterialModule } from '../material.module';
|
||||||
|
import { ContentManagementService } from '../common/services/content-management.service';
|
||||||
|
import { NodeActionsService } from '../common/services/node-actions.service';
|
||||||
|
import { NodePermissionService } from '../common/services/node-permission.service';
|
||||||
|
import { BrowsingFilesService } from '../common/services/browsing-files.service';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [
|
imports: [
|
||||||
NoopAnimationsModule,
|
NoopAnimationsModule,
|
||||||
HttpClientModule,
|
HttpClientModule,
|
||||||
RouterTestingModule,
|
RouterTestingModule,
|
||||||
StoreModule.forRoot({ app: appReducer }, { initialState: INITIAL_STATE }),
|
MaterialModule,
|
||||||
|
StoreModule.forRoot(
|
||||||
|
{ app: appReducer },
|
||||||
|
{ initialState: INITIAL_STATE }
|
||||||
|
),
|
||||||
EffectsModule.forRoot([])
|
EffectsModule.forRoot([])
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [TranslatePipeMock],
|
||||||
TranslatePipeMock
|
exports: [TranslatePipeMock, RouterTestingModule, MaterialModule],
|
||||||
],
|
|
||||||
exports: [
|
|
||||||
TranslatePipeMock,
|
|
||||||
RouterTestingModule
|
|
||||||
],
|
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: TranslationService, useClass: TranslationMock },
|
{ provide: TranslationService, useClass: TranslationMock },
|
||||||
{ provide: TranslateService, useClass: TranslateServiceMock },
|
{ provide: TranslateService, useClass: TranslateServiceMock },
|
||||||
{ provide: TranslatePipe, useClass: TranslatePipeMock }
|
{ provide: TranslatePipe, useClass: TranslatePipeMock },
|
||||||
|
{
|
||||||
|
provide: AuthenticationService,
|
||||||
|
useValue: {
|
||||||
|
isEcmLoggedIn(): boolean {
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
getRedirect(): string {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
UserPreferencesService,
|
||||||
|
AppConfigService,
|
||||||
|
StorageService,
|
||||||
|
CookieService,
|
||||||
|
AlfrescoApiService,
|
||||||
|
LogService,
|
||||||
|
NotificationService,
|
||||||
|
NodesApiService,
|
||||||
|
ContentService,
|
||||||
|
ThumbnailService,
|
||||||
|
UploadService,
|
||||||
|
CustomResourcesService,
|
||||||
|
DocumentListService,
|
||||||
|
PeopleContentService,
|
||||||
|
|
||||||
|
ContentManagementService,
|
||||||
|
NodeActionsService,
|
||||||
|
NodePermissionService,
|
||||||
|
BrowsingFilesService
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class AppTestingModule {}
|
export class AppTestingModule {}
|
||||||
|
@ -25,10 +25,19 @@
|
|||||||
|
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
|
import { Observable } from 'rxjs/Observable';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class TranslateServiceMock extends TranslateService {
|
export class TranslateServiceMock extends TranslateService {
|
||||||
constructor() {
|
constructor() {
|
||||||
super(null, null, null, null, null);
|
super(null, null, null, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get(key: string | Array<string>, interpolateParams?: Object): Observable<string | any> {
|
||||||
|
return Observable.of(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
instant(key: string | Array<string>, interpolateParams?: Object): string | any {
|
||||||
|
return key;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user