[ACA-1137] Spike - Improving speed of unit tests (#193)

* improve tests

* improve tests

* improve tests

* improve tests
This commit is contained in:
Denys Vuika
2018-02-21 13:21:59 +00:00
committed by Cilibiu Bogdan
parent 5234a875e7
commit ed2f91ee7c
4 changed files with 89 additions and 13 deletions

View File

@@ -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);