Skip to content

Commit

Permalink
add PR to changelog, add DatasetTree coverage
Browse files Browse the repository at this point in the history
Signed-off-by: Trae Yelovich <[email protected]>
  • Loading branch information
traeok committed Nov 19, 2024
1 parent 004622c commit 0fa8d9f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/zowe-explorer/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ All notable changes to the "vscode-extension-for-zowe" extension will be documen
- Fixed an issue where the location prompt for the `Create Directory` and `Create File` USS features would appear even when a path is already set for the profile or parent folder. [#3183](https://github.com/zowe/zowe-explorer-vscode/pull/3183)
- Fixed an issue where the `Create Directory` and `Create File` features would continue processing when the first prompt was dismissed, causing an incorrect path to be generated. [#3183](https://github.com/zowe/zowe-explorer-vscode/pull/3183)
- Fixed an issue where the `Create Directory` and `Create File` features would incorrectly handle user-specified locations with trailing slashes. [#3183](https://github.com/zowe/zowe-explorer-vscode/pull/3183)
- Fixed an issue where renaming a data set with unsaved changes did not cancel the rename operation. Now, when renaming a data set with unsaved changes, you will be prompted to resolve them before continuing.
- Fixed an issue where renaming a data set with unsaved changes did not cancel the rename operation. Now, when renaming a data set with unsaved changes, you will be prompted to resolve them before continuing. [#3328](https://github.com/zowe/zowe-explorer-vscode/pull/3328)

## `2.18.0`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ import { join } from "path";
import { mocked } from "../../../__mocks__/mockUtils";
import * as sharedUtils from "../../../src/shared/utils";
import { LocalFileManagement } from "../../../src/utils/LocalFileManagement";
import { TreeViewUtils } from "../../../src/utils/TreeViewUtils";

jest.mock("fs");
jest.mock("util");
Expand Down Expand Up @@ -2456,6 +2457,27 @@ describe("Dataset Tree Unit Tests - Function rename", () => {
expect(renameDataSetSpy).toHaveBeenLastCalledWith("HLQ.TEST.RENAME.NODE", "HLQ.TEST.RENAME.NODE.NEW");
});

it("returns early if errorForUnsavedResource was true", async () => {
createGlobalMocks();
const blockMocks = createBlockMocks();
mocked(Profiles.getInstance).mockReturnValue(blockMocks.profileInstance);
mocked(vscode.window.createTreeView).mockReturnValueOnce(blockMocks.treeView);
const testTree = new DatasetTree();
testTree.mSessionNodes.push(blockMocks.datasetSessionNode);
const node = new ZoweDatasetNode({
label: "HLQ.TEST.RENAME.NODE",
collapsibleState: vscode.TreeItemCollapsibleState.None,
parentNode: testTree.mSessionNodes[1],
session: blockMocks.session,
profile: testTree.mSessionNodes[1].getProfile(),
});
const renameDataSet = jest.spyOn(testTree as any, "renameDataSet");
const promptedForUnsavedResource = jest.spyOn(TreeViewUtils, "errorForUnsavedResource").mockResolvedValueOnce(true);
await testTree.rename(node);
expect(promptedForUnsavedResource).toHaveBeenCalled();
expect(renameDataSet).not.toHaveBeenCalled();
});

it("Checking function with PS Dataset using Unverified profile", async () => {
globals.defineGlobals("");
createGlobalMocks();
Expand Down

0 comments on commit 0fa8d9f

Please sign in to comment.