Skip to content

Commit

Permalink
[AAE-14851] Convert manual tests to unit for C587091, C587092 (#8608)
Browse files Browse the repository at this point in the history
* [AAE-14851] Convert manual tests to unit for C587091, C587092

* remove useless unit test

* implement suggestions
  • Loading branch information
tomgny committed Jun 5, 2023
1 parent 21281ca commit 9845b1e
Showing 1 changed file with 5 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -378,32 +378,22 @@ 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();
clickOnAttachFileWidget('attach-file-alfresco');
fixture.detectChanges();
await fixture.whenStable();

expect(widget.rootNodeId).toEqual('-my-');
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 () => {
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();
const wrongAlias = allSourceWithWrongAliasParams.fileSource.destinationFolderPath.value;

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();
Expand Down

0 comments on commit 9845b1e

Please sign in to comment.