mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-31 17:38:48 +00:00
Adjust ADF to latest JS-API version (#8882)
* Bump js-api version * Fix imports * Fix content-services unit tests * Fix process-services unit tests * [ci:force] Trigger CI * Fix code smells * Fix orderBy param * Fix code smells * Fix failing unit tests * Bump js-api version and align with new changes * Remove dangling coma * Fix delete return type * Add correct date format in task filters e2es * Fix typing in task filter sorting * Fix activiti content api import * Add null check for has avatar * Make User class instead of type * Fix user type in comment model * Fix sonar cloud issue * Type fixes * Update js-api version
This commit is contained in:
@@ -50,11 +50,11 @@ const fakeSiteList: SitePaging = new SitePaging({
|
||||
},
|
||||
entries: [
|
||||
{
|
||||
entry: {
|
||||
entry: new Site({
|
||||
id: 'FAKE',
|
||||
guid: 'FAKE-GUID',
|
||||
title: 'FAKE-SITE-TITLE'
|
||||
}
|
||||
})
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@
|
||||
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
import { ComponentFixture, fakeAsync, flush, TestBed, tick } from '@angular/core/testing';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { Node, NodeEntry, NodePaging, RequestScope, ResultSetPaging, SiteEntry, SitePaging } from '@alfresco/js-api';
|
||||
import { Node, NodeEntry, NodePaging, RequestScope, ResultSetPaging, SiteEntry, SitePaging, SitePagingList } from '@alfresco/js-api';
|
||||
import { of } from 'rxjs';
|
||||
import { ContentNodeSelectorPanelComponent } from './content-node-selector-panel.component';
|
||||
import { ContentTestingModule } from '../testing/content.testing.module';
|
||||
@@ -134,13 +134,13 @@ describe('ContentNodeSelectorPanelComponent', () => {
|
||||
list: {
|
||||
pagination: {},
|
||||
entries: [],
|
||||
source: {}
|
||||
source: new Node()
|
||||
}
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
spyOn(sitesService, 'getSites').and.returnValue(of(new SitePaging({ list: { entries: [] } })));
|
||||
spyOn(sitesService, 'getSites').and.returnValue(of(new SitePaging({ list: new SitePagingList({ entries: [] }) })));
|
||||
|
||||
customResourcesService = TestBed.inject(CustomResourcesService);
|
||||
getCorrespondingNodeIdsSpy = spyOn(customResourcesService, 'getCorrespondingNodeIds').and.callFake((id) => {
|
||||
|
@@ -18,7 +18,7 @@
|
||||
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
||||
import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { Node, NodeEntry, NodePaging, ResultSetPaging, SiteEntry, SitePaging, UserInfo } from '@alfresco/js-api';
|
||||
import { Node, NodeEntry, NodePaging, PathElement, ResultSetPaging, Site, SiteEntry, SitePaging, SitePagingList, UserInfo } from '@alfresco/js-api';
|
||||
import { AppConfigService, DataRow, ThumbnailService, DataColumn } from '@alfresco/adf-core';
|
||||
import { ContentService } from '../common/services/content.service';
|
||||
import { UploadService } from '../common/services/upload.service';
|
||||
@@ -123,7 +123,7 @@ describe('ContentNodeSelectorPanelComponent', () => {
|
||||
|
||||
describe('Site selection', () => {
|
||||
beforeEach(() => {
|
||||
spyOn(sitesService, 'getSites').and.returnValue(of(new SitePaging({ list: { entries: [] } })));
|
||||
spyOn(sitesService, 'getSites').and.returnValue(of(new SitePaging({ list: new SitePagingList({ entries: [] }) })));
|
||||
component.currentFolderId = 'fake-starting-folder';
|
||||
});
|
||||
|
||||
@@ -138,7 +138,7 @@ describe('ContentNodeSelectorPanelComponent', () => {
|
||||
});
|
||||
|
||||
it('should trigger siteChange event when a site is selected in sites-dropdown', async () => {
|
||||
const fakeSiteEntry = new SiteEntry({ entry: { title: 'fake-new-site', guid: 'fake-new-site' } });
|
||||
const fakeSiteEntry = new SiteEntry({ entry: new Site({ title: 'fake-new-site', guid: 'fake-new-site' }) });
|
||||
fixture.detectChanges();
|
||||
await fixture.whenStable();
|
||||
|
||||
@@ -162,9 +162,9 @@ describe('ContentNodeSelectorPanelComponent', () => {
|
||||
spyOn(sitesService, 'getSites').and.returnValue(
|
||||
of(
|
||||
new SitePaging({
|
||||
list: {
|
||||
entries: [{ entry: { guid: 'namek', id: 'namek' } }, { entry: { guid: 'blog', id: 'blog' } }]
|
||||
}
|
||||
list: new SitePagingList({
|
||||
entries: [{ entry: new Site({ guid: 'namek', id: 'namek' }) }, { entry: new Site({ guid: 'blog', id: 'blog' }) }]
|
||||
})
|
||||
})
|
||||
)
|
||||
);
|
||||
@@ -262,7 +262,7 @@ describe('ContentNodeSelectorPanelComponent', () => {
|
||||
|
||||
spyOn(documentListService, 'getFolderNode').and.returnValue(of(new NodeEntry()));
|
||||
spyOn(documentListService, 'getFolder').and.returnValue(throwError('No results for test'));
|
||||
spyOn(sitesService, 'getSites').and.returnValue(of(new SitePaging({ list: { entries: [] } })));
|
||||
spyOn(sitesService, 'getSites').and.returnValue(of(new SitePaging({ list: new SitePagingList({ entries: [] }) })));
|
||||
|
||||
component.currentFolderId = 'cat-girl-nuku-nuku';
|
||||
fixture.detectChanges();
|
||||
@@ -303,7 +303,7 @@ describe('ContentNodeSelectorPanelComponent', () => {
|
||||
searchQueryBuilderService.update();
|
||||
triggerSearchResults(fakeResultSetPaging);
|
||||
|
||||
const chosenNode = new Node({ path: { elements: ['one'] } });
|
||||
const chosenNode = new Node({ path: { elements: [new PathElement({ name: 'one' })] } });
|
||||
component.onCurrentSelection([{ entry: chosenNode }]);
|
||||
fixture.detectChanges();
|
||||
|
||||
@@ -318,7 +318,7 @@ describe('ContentNodeSelectorPanelComponent', () => {
|
||||
searchQueryBuilderService.update();
|
||||
triggerSearchResults(fakeResultSetPaging);
|
||||
|
||||
const chosenNode = new Node({ path: { elements: ['fake-path'] }, isFile: false, isFolder: true });
|
||||
const chosenNode = new Node({ path: { elements: [new PathElement({ name: 'fake-path' })] }, isFile: false, isFolder: true });
|
||||
component.onCurrentSelection([{ entry: chosenNode }]);
|
||||
fixture.detectChanges();
|
||||
|
||||
@@ -384,7 +384,7 @@ describe('ContentNodeSelectorPanelComponent', () => {
|
||||
const rows = [{}, {}] as DataRow[];
|
||||
component.documentList.data = new ShareDataTableAdapter(thumbnailService, contentService, schema);
|
||||
spyOn(component.documentList.data, 'getRows').and.returnValue(rows);
|
||||
spyOn(sitesService, 'getSites').and.returnValue(of(new SitePaging({ list: { entries: [] } })));
|
||||
spyOn(sitesService, 'getSites').and.returnValue(of(new SitePaging({ list: new SitePagingList({ entries: [] }) })));
|
||||
});
|
||||
|
||||
it('should the selection become the currently navigated folder when the folder loads (Acts as destination for cases like copy action)', () => {
|
||||
@@ -655,7 +655,10 @@ describe('ContentNodeSelectorPanelComponent', () => {
|
||||
|
||||
it('should return only the last uploaded node to become preselected when the selection mode is single', () => {
|
||||
fixture.detectChanges();
|
||||
const fakeNodes = [new NodeEntry({ id: 'fakeNode1' }), new NodeEntry({ id: 'fakeNode2' })];
|
||||
const fakeNodes = [
|
||||
new NodeEntry({ entry: new Node({ id: 'fakeNode1' }) }),
|
||||
new NodeEntry({ entry: new Node({ id: 'fakeNode2' }) })
|
||||
];
|
||||
component.currentUploadBatch = fakeNodes;
|
||||
component.selectionMode = 'single';
|
||||
|
||||
@@ -664,7 +667,10 @@ describe('ContentNodeSelectorPanelComponent', () => {
|
||||
|
||||
it('should return all the uploaded nodes to become preselected when the selection mode is multiple', () => {
|
||||
fixture.detectChanges();
|
||||
const fakeNodes = [new NodeEntry({ id: 'fakeNode1' }), new NodeEntry({ id: 'fakeNode2' })];
|
||||
const fakeNodes = [
|
||||
new NodeEntry({ entry: new Node({ id: 'fakeNode1' }) }),
|
||||
new NodeEntry({ entry: new Node({ id: 'fakeNode2' }) })
|
||||
];
|
||||
component.currentUploadBatch = fakeNodes;
|
||||
component.selectionMode = 'multiple';
|
||||
|
||||
|
@@ -19,7 +19,7 @@ import { MAT_DIALOG_DATA, MatDialogModule, MatDialogRef } from '@angular/materia
|
||||
import { CUSTOM_ELEMENTS_SCHEMA, EventEmitter } from '@angular/core';
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { ContentNodeSelectorComponent } from './content-node-selector.component';
|
||||
import { Node, NodeEntry, SitePaging } from '@alfresco/js-api';
|
||||
import { Node, NodeEntry, SitePaging, SitePagingList } from '@alfresco/js-api';
|
||||
import { By } from '@angular/platform-browser';
|
||||
import { FileModel } from '../common/models/file.model';
|
||||
import { FileUploadEvent } from '../common/events/file.event';
|
||||
@@ -88,7 +88,7 @@ describe('ContentNodeSelectorComponent', () => {
|
||||
|
||||
spyOn(documentListService, 'getFolder');
|
||||
spyOn(documentListService, 'getFolderNode');
|
||||
spyOn(sitesService, 'getSites').and.returnValue(of(new SitePaging({ list: { entries: [] } })));
|
||||
spyOn(sitesService, 'getSites').and.returnValue(of(new SitePaging({ list: new SitePagingList({ entries: [] }) })));
|
||||
|
||||
fixture = TestBed.createComponent(ContentNodeSelectorComponent);
|
||||
component = fixture.componentInstance;
|
||||
@@ -97,15 +97,12 @@ describe('ContentNodeSelectorComponent', () => {
|
||||
spyOn(contentService, 'hasAllowableOperations').and.returnValue(true);
|
||||
|
||||
const fakeFolderNodeWithPermission = new NodeEntry({
|
||||
entry: {
|
||||
allowableOperations: [
|
||||
'create',
|
||||
'update'
|
||||
],
|
||||
entry: new Node({
|
||||
allowableOperations: ['create', 'update'],
|
||||
isFolder: true,
|
||||
name: 'Folder Fake Name',
|
||||
nodeType: 'cm:folder'
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
const nodesApiService = TestBed.inject(NodesApiService);
|
||||
|
Reference in New Issue
Block a user