mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +00:00
[AAE-14851] Convert manual tests to unit for C587091, C587092 (#8608)
* [AAE-14851] Convert manual tests to unit for C587091, C587092 * remove useless unit test * implement suggestions
This commit is contained in:
parent
21281cafe9
commit
9845b1e2a0
@ -378,6 +378,7 @@ describe('AttachFileCloudWidgetComponent', () => {
|
|||||||
|
|
||||||
it('Should set default user alias (-my-) as rootNodeId if destinationFolderPath contains wrong alias and single upload for Alfresco Content + Locale', async () => {
|
it('Should set default user alias (-my-) as rootNodeId if destinationFolderPath contains wrong alias and single upload for Alfresco Content + Locale', async () => {
|
||||||
spyOn(contentCloudNodeSelectorService, 'getNodeIdFromPath').and.returnValue(mockMyNodeId);
|
spyOn(contentCloudNodeSelectorService, 'getNodeIdFromPath').and.returnValue(mockMyNodeId);
|
||||||
|
const getAliasSpy = spyOn(widget, 'getAliasAndRelativePathFromDestinationFolderPath').and.callThrough();
|
||||||
createUploadWidgetField(new FormModel(), 'attach-file-alfresco', [], allSourceWithWrongAliasParams, false);
|
createUploadWidgetField(new FormModel(), 'attach-file-alfresco', [], allSourceWithWrongAliasParams, false);
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
await fixture.whenStable();
|
await fixture.whenStable();
|
||||||
@ -385,25 +386,14 @@ describe('AttachFileCloudWidgetComponent', () => {
|
|||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
await fixture.whenStable();
|
await fixture.whenStable();
|
||||||
|
|
||||||
expect(widget.rootNodeId).toEqual('-my-');
|
const wrongAlias = allSourceWithWrongAliasParams.fileSource.destinationFolderPath.value;
|
||||||
expect(openUploadFileDialogSpy).toHaveBeenCalledWith('-my-', 'single', true, true);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('Should set default user alias (-my-) as rootNodeId if destinationFolderPath contains wrong alias and multiple upload for Alfresco Content + Locale', async () => {
|
expect(getAliasSpy).toHaveBeenCalledOnceWith(wrongAlias);
|
||||||
spyOn(contentCloudNodeSelectorService, 'getNodeIdFromPath').and.returnValue(mockMyNodeId);
|
expect(widget.getAliasAndRelativePathFromDestinationFolderPath(wrongAlias)).toEqual({ alias: '-my-', path: undefined });
|
||||||
createUploadWidgetField(new FormModel(), 'attach-file-alfresco', [], allSourceWithWrongAliasParams, true);
|
|
||||||
fixture.detectChanges();
|
|
||||||
await fixture.whenStable();
|
|
||||||
clickOnAttachFileWidget('attach-file-alfresco');
|
|
||||||
fixture.detectChanges();
|
|
||||||
await fixture.whenStable();
|
|
||||||
|
|
||||||
expect(widget.rootNodeId).toEqual('-my-');
|
|
||||||
expect(openUploadFileDialogSpy).toHaveBeenCalledWith('-my-', 'multiple', true, true);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Should set default user alias (-my-) as rootNodeId if destinationFolderPath does not have alias for Alfresco Content + Locale', async () => {
|
it('Should set default user alias (-my-) as rootNodeId if destinationFolderPath does not have alias for Alfresco Content + Locale', async () => {
|
||||||
spyOn(contentCloudNodeSelectorService, 'getNodeIdFromPath').and.returnValue(mockMyNodeId);
|
spyOn(contentCloudNodeSelectorService, 'getNodeIdFromPath').and.returnValue(undefined);
|
||||||
createUploadWidgetField(new FormModel(), 'attach-file-alfresco', [], allSourceWithNoAliasParams, true);
|
createUploadWidgetField(new FormModel(), 'attach-file-alfresco', [], allSourceWithNoAliasParams, true);
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
await fixture.whenStable();
|
await fixture.whenStable();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user