diff --git a/packages/zowe-explorer/__tests__/__unit__/uss/actions.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/uss/actions.unit.test.ts index 4c84b3d6ec..797f1ee46b 100644 --- a/packages/zowe-explorer/__tests__/__unit__/uss/actions.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/uss/actions.unit.test.ts @@ -891,9 +891,7 @@ describe("USS Action Unit Tests - copy file / directory", () => { it("tests pasteUssFile executed successfully with selected nodes", async () => { const globalMocks = createGlobalMocks(); const blockMocks = await createBlockMocks(globalMocks); - const parent = blockMocks.treeNodes.testUSSTree.getTreeView(); - parent.selection = blockMocks.nodes[0]; - await ussNodeActions.pasteUssFile(blockMocks.treeNodes.testUSSTree, undefined); + await ussNodeActions.pasteUssFile(blockMocks.treeNodes.testUSSTree, blockMocks.nodes[0]); expect(sharedUtils.getSelectedNodeList(blockMocks.treeNodes.ussNode, blockMocks.treeNodes.ussNodes)).toEqual([blockMocks.treeNodes.ussNode]); }); it("tests pasteUssFile executed successfully with one node", async () => { @@ -905,6 +903,16 @@ describe("USS Action Unit Tests - copy file / directory", () => { await ussNodeActions.pasteUssFile(blockMocks.treeNodes.testUSSTree, blockMocks.nodes[0]); expect(sharedUtils.getSelectedNodeList(blockMocks.treeNodes.ussNode, blockMocks.treeNodes.ussNodes)).toEqual([blockMocks.treeNodes.ussNode]); }); + it("tests pasteUss returns early if APIs are not supported", async () => { + const globalMocks = createGlobalMocks(); + const blockMocks = await createBlockMocks(globalMocks); + const testNode = blockMocks.nodes[0]; + testNode.copyUssFile = testNode.pasteUssTree = null; + const infoMessageSpy = jest.spyOn(Gui, "infoMessage"); + await ussNodeActions.pasteUss(blockMocks.treeNodes.testUSSTree, testNode); + expect(infoMessageSpy).toHaveBeenCalledWith("The paste operation is not supported for this node."); + infoMessageSpy.mockRestore(); + }); }); describe("USS Action Unit Tests - function deleteUSSFilesPrompt", () => {