Skip to content

Commit

Permalink
test(uss): Add test case for pasteUss - unsupported APIs
Browse files Browse the repository at this point in the history
Signed-off-by: Trae Yelovich <[email protected]>
  • Loading branch information
traeok committed Sep 27, 2023
1 parent 1f36769 commit 9d74b9b
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions packages/zowe-explorer/__tests__/__unit__/uss/actions.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand All @@ -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", () => {
Expand Down

0 comments on commit 9d74b9b

Please sign in to comment.