mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-31 17:38:28 +00:00
[ACA-1443] prettier formatting and checks (#629)
* intergrate prettier * update settings * integrate with travis * unified formatting across all files
This commit is contained in:
@@ -26,8 +26,12 @@
|
||||
import { TestBed, ComponentFixture } from '@angular/core/testing';
|
||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import {
|
||||
AlfrescoApiService,
|
||||
TimeAgoPipe, NodeNameTooltipPipe, NodeFavoriteDirective, DataTableComponent, AppConfigPipe
|
||||
AlfrescoApiService,
|
||||
TimeAgoPipe,
|
||||
NodeNameTooltipPipe,
|
||||
NodeFavoriteDirective,
|
||||
DataTableComponent,
|
||||
AppConfigPipe
|
||||
} from '@alfresco/adf-core';
|
||||
import { DocumentListComponent } from '@alfresco/adf-content-services';
|
||||
import { ContentManagementService } from '../../services/content-management.service';
|
||||
@@ -37,91 +41,93 @@ import { AppTestingModule } from '../../testing/app-testing.module';
|
||||
import { ExperimentalDirective } from '../../directives/experimental.directive';
|
||||
|
||||
describe('RecentFilesComponent', () => {
|
||||
let fixture: ComponentFixture<RecentFilesComponent>;
|
||||
let component: RecentFilesComponent;
|
||||
let alfrescoApi: AlfrescoApiService;
|
||||
let contentService: ContentManagementService;
|
||||
let page;
|
||||
let fixture: ComponentFixture<RecentFilesComponent>;
|
||||
let component: RecentFilesComponent;
|
||||
let alfrescoApi: AlfrescoApiService;
|
||||
let contentService: ContentManagementService;
|
||||
let page;
|
||||
|
||||
beforeEach(() => {
|
||||
page = {
|
||||
list: {
|
||||
entries: [{ entry: { id: 1 } }, { entry: { id: 2 } }],
|
||||
pagination: { data: 'data' }
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [AppTestingModule],
|
||||
declarations: [
|
||||
DataTableComponent,
|
||||
TimeAgoPipe,
|
||||
NodeNameTooltipPipe,
|
||||
NodeFavoriteDirective,
|
||||
DocumentListComponent,
|
||||
RecentFilesComponent,
|
||||
AppConfigPipe,
|
||||
ExperimentalDirective
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
});
|
||||
|
||||
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({
|
||||
entry: { id: 'personId' }
|
||||
})
|
||||
);
|
||||
|
||||
spyOn(alfrescoApi.searchApi, 'search').and.returnValue(
|
||||
Promise.resolve(page)
|
||||
);
|
||||
});
|
||||
|
||||
describe('OnInit()', () => {
|
||||
beforeEach(() => {
|
||||
page = {
|
||||
list: {
|
||||
entries: [ { entry: { id: 1 } }, { entry: { id: 2 } } ],
|
||||
pagination: { data: 'data'}
|
||||
}
|
||||
};
|
||||
spyOn(component, 'reload').and.stub();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
AppTestingModule
|
||||
],
|
||||
declarations: [
|
||||
DataTableComponent,
|
||||
TimeAgoPipe,
|
||||
NodeNameTooltipPipe,
|
||||
NodeFavoriteDirective,
|
||||
DocumentListComponent,
|
||||
RecentFilesComponent,
|
||||
AppConfigPipe,
|
||||
ExperimentalDirective
|
||||
],
|
||||
schemas: [ NO_ERRORS_SCHEMA ]
|
||||
});
|
||||
it('should reload nodes on onDeleteNode event', () => {
|
||||
fixture.detectChanges();
|
||||
|
||||
fixture = TestBed.createComponent(RecentFilesComponent);
|
||||
component = fixture.componentInstance;
|
||||
contentService.nodesDeleted.next();
|
||||
|
||||
contentService = TestBed.get(ContentManagementService);
|
||||
alfrescoApi = TestBed.get(AlfrescoApiService);
|
||||
alfrescoApi.reset();
|
||||
|
||||
spyOn(alfrescoApi.peopleApi, 'getPerson').and.returnValue(Promise.resolve({
|
||||
entry: { id: 'personId' }
|
||||
}));
|
||||
|
||||
spyOn(alfrescoApi.searchApi, 'search').and.returnValue(Promise.resolve(page));
|
||||
expect(component.reload).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
describe('OnInit()', () => {
|
||||
beforeEach(() => {
|
||||
spyOn(component, 'reload').and.stub();
|
||||
});
|
||||
it('should reload on onRestoreNode event', () => {
|
||||
fixture.detectChanges();
|
||||
|
||||
it('should reload nodes on onDeleteNode event', () => {
|
||||
fixture.detectChanges();
|
||||
contentService.nodesRestored.next();
|
||||
|
||||
contentService.nodesDeleted.next();
|
||||
|
||||
expect(component.reload).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should reload on onRestoreNode event', () => {
|
||||
fixture.detectChanges();
|
||||
|
||||
contentService.nodesRestored.next();
|
||||
|
||||
expect(component.reload).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should reload on move node event', () => {
|
||||
fixture.detectChanges();
|
||||
|
||||
contentService.nodesMoved.next();
|
||||
|
||||
expect(component.reload).toHaveBeenCalled();
|
||||
});
|
||||
expect(component.reload).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
describe('refresh', () => {
|
||||
it('should call document list reload', () => {
|
||||
spyOn(component.documentList, 'reload');
|
||||
fixture.detectChanges();
|
||||
it('should reload on move node event', () => {
|
||||
fixture.detectChanges();
|
||||
|
||||
component.reload();
|
||||
contentService.nodesMoved.next();
|
||||
|
||||
expect(component.documentList.reload).toHaveBeenCalled();
|
||||
});
|
||||
expect(component.reload).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
describe('refresh', () => {
|
||||
it('should call document list reload', () => {
|
||||
spyOn(component.documentList, 'reload');
|
||||
fixture.detectChanges();
|
||||
|
||||
component.reload();
|
||||
|
||||
expect(component.documentList.reload).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user