[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:
Tomasz Gnyp 2023-06-05 12:23:30 +02:00 committed by GitHub
parent 21281cafe9
commit 9845b1e2a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 () => {
spyOn(contentCloudNodeSelectorService, 'getNodeIdFromPath').and.returnValue(mockMyNodeId);
const getAliasSpy = spyOn(widget, 'getAliasAndRelativePathFromDestinationFolderPath').and.callThrough();
createUploadWidgetField(new FormModel(), 'attach-file-alfresco', [], allSourceWithWrongAliasParams, false);
fixture.detectChanges();
await fixture.whenStable();
@ -385,25 +386,14 @@ describe('AttachFileCloudWidgetComponent', () => {
fixture.detectChanges();
await fixture.whenStable();
expect(widget.rootNodeId).toEqual('-my-');
expect(openUploadFileDialogSpy).toHaveBeenCalledWith('-my-', 'single', true, true);
});
const wrongAlias = allSourceWithWrongAliasParams.fileSource.destinationFolderPath.value;
it('Should set default user alias (-my-) as rootNodeId if destinationFolderPath contains wrong alias and multiple upload for Alfresco Content + Locale', async () => {
spyOn(contentCloudNodeSelectorService, 'getNodeIdFromPath').and.returnValue(mockMyNodeId);
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);
expect(getAliasSpy).toHaveBeenCalledOnceWith(wrongAlias);
expect(widget.getAliasAndRelativePathFromDestinationFolderPath(wrongAlias)).toEqual({ alias: '-my-', path: undefined });
});
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);
fixture.detectChanges();
await fixture.whenStable();