mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-31 17:38:28 +00:00
[ACA-1137] Spike - Improving speed of unit tests (#193)
* improve tests * improve tests * improve tests * improve tests
This commit is contained in:
committed by
Cilibiu Bogdan
parent
5234a875e7
commit
ed2f91ee7c
@@ -29,11 +29,20 @@ import { By } from '@angular/platform-browser';
|
||||
|
||||
import { Observable } from 'rxjs/Rx';
|
||||
|
||||
import { TranslationService, 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 { CommonModule } from '../common.module';
|
||||
import { NodeActionsService } from '../services/node-actions.service';
|
||||
import { NodeCopyDirective } from './node-copy.directive';
|
||||
import { ContentManagementService } from '../services/content-management.service';
|
||||
import { MatSnackBarModule, MatDialogModule, MatIconModule } from '@angular/material';
|
||||
import { DocumentListService } from '@alfresco/adf-content-services';
|
||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||
|
||||
@Component({
|
||||
template: '<div [app-copy-node]="selection"></div>'
|
||||
@@ -54,10 +63,33 @@ describe('NodeCopyDirective', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
CommonModule
|
||||
NoopAnimationsModule,
|
||||
HttpClientModule,
|
||||
TranslateModule.forRoot(),
|
||||
MatSnackBarModule,
|
||||
MatDialogModule,
|
||||
MatIconModule
|
||||
],
|
||||
declarations: [
|
||||
TestComponent
|
||||
TestComponent,
|
||||
NodeCopyDirective
|
||||
],
|
||||
providers: [
|
||||
AlfrescoApiService,
|
||||
AuthenticationService,
|
||||
AppConfigService,
|
||||
StorageService,
|
||||
ContentService,
|
||||
UserPreferencesService,
|
||||
LogService,
|
||||
CookieService,
|
||||
NotificationService,
|
||||
NodesApiService,
|
||||
NodeActionsService,
|
||||
{ provide: TranslationService, useClass: TranslationMock },
|
||||
ContentManagementService,
|
||||
DocumentListService,
|
||||
ThumbnailService
|
||||
]
|
||||
});
|
||||
|
||||
|
@@ -104,7 +104,7 @@ export class NodeCopyDirective {
|
||||
} catch (err) { /* Do nothing, keep the original message */ }
|
||||
}
|
||||
|
||||
const undo = (numberOfCopiedItems > 0) ? this.translation.translate.instant('APP.ACTIONS.UNDO') : '';
|
||||
const undo = (numberOfCopiedItems > 0) ? this.translation.instant('APP.ACTIONS.UNDO') : '';
|
||||
const withUndo = (numberOfCopiedItems > 0) ? '_WITH_UNDO' : '';
|
||||
|
||||
this.translation.get(i18nMessageString, { success: numberOfCopiedItems, failed: failedItems }).subscribe(message => {
|
||||
|
@@ -24,15 +24,21 @@
|
||||
*/
|
||||
|
||||
import { TestBed, async } from '@angular/core/testing';
|
||||
import { MatDialog } from '@angular/material';
|
||||
import { MatDialog, MatDialogModule, MatIconModule } from '@angular/material';
|
||||
import { OverlayModule } from '@angular/cdk/overlay';
|
||||
import { Observable } from 'rxjs/Rx';
|
||||
import { AlfrescoApiService, NodesApiService, TranslationService } from '@alfresco/adf-core';
|
||||
import {
|
||||
TranslationMock, AlfrescoApiService, NodesApiService,
|
||||
TranslationService, ContentService, AuthenticationService,
|
||||
UserPreferencesService, AppConfigService, StorageService,
|
||||
CookieService, LogService, ThumbnailService
|
||||
} from '@alfresco/adf-core';
|
||||
import { DocumentListService } from '@alfresco/adf-content-services';
|
||||
|
||||
import { CommonModule } from '../common.module';
|
||||
import { NodeActionsService } from './node-actions.service';
|
||||
import { MinimalNodeEntryEntity } from 'alfresco-js-api';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
|
||||
class TestNode {
|
||||
entry?: MinimalNodeEntryEntity;
|
||||
@@ -104,8 +110,26 @@ describe('NodeActionsService', () => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
MatDialogModule,
|
||||
MatIconModule,
|
||||
HttpClientModule,
|
||||
TranslateModule.forRoot(),
|
||||
OverlayModule
|
||||
],
|
||||
providers: [
|
||||
AlfrescoApiService,
|
||||
NodesApiService,
|
||||
{ provide: TranslationService, useClass: TranslationMock },
|
||||
AuthenticationService,
|
||||
UserPreferencesService,
|
||||
AppConfigService,
|
||||
CookieService,
|
||||
LogService,
|
||||
ThumbnailService,
|
||||
StorageService,
|
||||
ContentService,
|
||||
DocumentListService,
|
||||
NodeActionsService
|
||||
]
|
||||
});
|
||||
|
||||
|
@@ -23,14 +23,21 @@
|
||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { Router, ActivatedRoute } from '@angular/router';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { TestBed, async, ComponentFixture } from '@angular/core/testing';
|
||||
import { AlfrescoApiService, UserPreferencesService } from '@alfresco/adf-core';
|
||||
import {
|
||||
AlfrescoApiService, UserPreferencesService, TranslationService, TranslationMock,
|
||||
AppConfigService, StorageService, CookieService, NotificationService
|
||||
} from '@alfresco/adf-core';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
|
||||
import { CommonModule } from '../../common/common.module';
|
||||
import { PreviewComponent } from './preview.component';
|
||||
import { Observable } from 'rxjs/Rx';
|
||||
import { ContentManagementService } from '../../common/services/content-management.service';
|
||||
import { MatSnackBarModule } from '@angular/material';
|
||||
|
||||
describe('PreviewComponent', () => {
|
||||
|
||||
@@ -44,12 +51,25 @@ describe('PreviewComponent', () => {
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
HttpClientModule,
|
||||
RouterTestingModule,
|
||||
CommonModule
|
||||
TranslateModule.forRoot(),
|
||||
MatSnackBarModule
|
||||
],
|
||||
providers: [
|
||||
{ provide: TranslationService, useClass: TranslationMock },
|
||||
AlfrescoApiService,
|
||||
AppConfigService,
|
||||
StorageService,
|
||||
CookieService,
|
||||
NotificationService,
|
||||
UserPreferencesService,
|
||||
ContentManagementService
|
||||
],
|
||||
declarations: [
|
||||
PreviewComponent
|
||||
]
|
||||
],
|
||||
schemas: [ NO_ERRORS_SCHEMA ]
|
||||
})
|
||||
.compileComponents().then(() => {
|
||||
fixture = TestBed.createComponent(PreviewComponent);
|
||||
|
Reference in New Issue
Block a user