mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-31 17:38:28 +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:
@@ -23,34 +23,21 @@
|
||||
* 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 { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { HttpClientModule } from '@angular/common/http';
|
||||
import {
|
||||
NotificationService, TranslationService, TranslationMock,
|
||||
NodesApiService, AlfrescoApiService, ContentService,
|
||||
UserPreferencesService, LogService, AppConfigService,
|
||||
StorageService, CookieService, ThumbnailService, AuthenticationService,
|
||||
NodesApiService, AlfrescoApiService,
|
||||
TimeAgoPipe, NodeNameTooltipPipe, NodeFavoriteDirective, DataTableComponent, AppConfigPipe
|
||||
} from '@alfresco/adf-core';
|
||||
import { DocumentListComponent, CustomResourcesService } 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 { DocumentListComponent } from '@alfresco/adf-content-services';
|
||||
import { ShareDataTableAdapter } from '@alfresco/adf-content-services';
|
||||
|
||||
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 { AppTestingModule } from '../../testing/app-testing.module';
|
||||
|
||||
describe('Libraries Routed Component', () => {
|
||||
describe('LibrariesComponent', () => {
|
||||
let fixture: ComponentFixture<LibrariesComponent>;
|
||||
let component: LibrariesComponent;
|
||||
let nodesApi: NodesApiService;
|
||||
@@ -75,17 +62,9 @@ describe('Libraries Routed Component', () => {
|
||||
};
|
||||
});
|
||||
|
||||
beforeEach(async(() => {
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
MatMenuModule,
|
||||
NoopAnimationsModule,
|
||||
HttpClientModule,
|
||||
TranslateModule.forRoot(),
|
||||
RouterTestingModule,
|
||||
MatSnackBarModule, MatIconModule,
|
||||
StoreModule.forRoot({ app: appReducer }, { initialState: INITIAL_STATE })
|
||||
],
|
||||
imports: [ AppTestingModule ],
|
||||
declarations: [
|
||||
DataTableComponent,
|
||||
TimeAgoPipe,
|
||||
@@ -96,36 +75,17 @@ describe('Libraries Routed Component', () => {
|
||||
AppConfigPipe,
|
||||
ExperimentalDirective
|
||||
],
|
||||
providers: [
|
||||
{ provide: TranslationService, useClass: TranslationMock },
|
||||
AuthenticationService,
|
||||
UserPreferencesService,
|
||||
AppConfigService, StorageService, CookieService,
|
||||
AlfrescoApiService,
|
||||
LogService,
|
||||
NotificationService,
|
||||
ContentService,
|
||||
NodesApiService,
|
||||
DocumentListService,
|
||||
ThumbnailService,
|
||||
CustomResourcesService,
|
||||
|
||||
ContentManagementService
|
||||
],
|
||||
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.peopleApi, 'getSiteMembership').and.returnValue((Promise.resolve({})));
|
||||
});
|
||||
|
Reference in New Issue
Block a user