Skip to content

Commit

Permalink
refactor: require a non-empty path before submitting uss search
Browse files Browse the repository at this point in the history
Signed-off-by: Trae Yelovich <trae.yelovich@broadcom.com>
  • Loading branch information
traeok committed Oct 31, 2024
1 parent 1496c06 commit 69e0a6d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -628,8 +628,6 @@ describe("USSTree Unit Tests - Function filterPrompt", () => {
globalMocks.showInputBox.mockReturnValueOnce(undefined);

await globalMocks.testTree.filterPrompt(globalMocks.testTree.mSessionNodes[1]);
expect(globalMocks.showInformationMessage.mock.calls.length).toBe(1);
expect(globalMocks.showInformationMessage.mock.calls[0][0]).toBe("You must enter a path.");
});

it("Tests that filter() works on a file", async () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/zowe-explorer/src/trees/uss/USSTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -744,11 +744,11 @@ export class USSTree extends ZoweTreeProvider<IZoweUSSTreeNode> implements Types
const options: vscode.InputBoxOptions = {
placeHolder: vscode.l10n.t("New filter"),
value: remotepath,
validateInput: (input: string) => (input.length > 0 ? null : vscode.l10n.t("Please enter a valid USS path.")),
};
// get user input
remotepath = await Gui.showInputBox(options);
if (!remotepath || remotepath.length === 0) {
Gui.showMessage(vscode.l10n.t("You must enter a path."));
if (remotepath == null) {
return;
}
} else {
Expand Down

0 comments on commit 69e0a6d

Please # to comment.