Skip to content

Commit

Permalink
Merge branch 'main' into Zowe-Sort-Jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
JillieBeanSim authored Sep 18, 2023
2 parents 5623883 + dfc5199 commit 2dbb394
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 2 additions & 0 deletions packages/zowe-explorer/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ All notable changes to the "vscode-extension-for-zowe" extension will be documen

### Bug fixes

- Fixed submitting local JCL using command pallet option `Zowe Explorer: Submit JCL` by adding a check for chosen profile returned to continue the action. [#1625](https://github.com/zowe/vscode-extension-for-zowe/issues/1625)

## `2.11.0`

### New features and enhancements
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -557,25 +557,25 @@ describe("Jobs Actions Unit Tests - Function submitJcl", () => {
);
});

it("Checking failed attempt to submit of active text editor content as JCL", async () => {
it("Checking failed attempt to submit of active text editor content as JCL without profile chosen from quickpick", async () => {
createGlobalMocks();
const blockMocks = createBlockMocks();
mocked(zowe.ZosmfSession.createSessCfgFromArgs).mockReturnValue(blockMocks.session.ISession);
mocked(Profiles.getInstance).mockReturnValue(blockMocks.profileInstance);
mocked(vscode.window.showQuickPick).mockResolvedValueOnce(null); // Here we imitate the case when no profile was selected
mocked(vscode.window.showQuickPick).mockResolvedValueOnce(undefined); // Here we imitate the case when no profile was selected
blockMocks.testDatasetTree.getChildren.mockResolvedValueOnce([
new ZoweDatasetNode("node", vscode.TreeItemCollapsibleState.None, blockMocks.datasetSessionNode, null),
blockMocks.datasetSessionNode,
]);
activeTextEditorDocument.mockReturnValue(blockMocks.textDocument);
const messageSpy = jest.spyOn(Gui, "infoMessage");
const submitJclSpy = jest.spyOn(blockMocks.jesApi, "submitJcl");
submitJclSpy.mockClear();

await dsActions.submitJcl(blockMocks.testDatasetTree);

expect(submitJclSpy).not.toBeCalled();
expect(mocked(ZoweLogger.error)).toBeCalled();
expect(mocked(ZoweLogger.error).mock.calls[0][0]).toEqual("Session for submitting JCL was null or undefined!");
expect(messageSpy).toBeCalledWith("Operation Cancelled");
});

it("Checking API error on submit of active text editor content as JCL", async () => {
Expand Down
4 changes: 4 additions & 0 deletions packages/zowe-explorer/src/dataset/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1000,6 +1000,10 @@ export async function submitJcl(datasetProvider: api.IZoweTree<api.IZoweDatasetT
canPickMany: false,
};
sessProfileName = await api.Gui.showQuickPick(profileNamesList, quickPickOptions);
if (!sessProfileName) {
api.Gui.infoMessage(localizedStrings.opCancelled);
return;
}
} else {
api.Gui.showMessage(localize("submitJcl.noProfile", "No profiles available"));
}
Expand Down

0 comments on commit 2dbb394

Please sign in to comment.