Skip to content

Commit

Permalink
Merge branch 'main' into fix/misc-profile-issues
Browse files Browse the repository at this point in the history
Signed-off-by: Timothy Johnson <timothy.johnson@broadcom.com>
  • Loading branch information
t1m0thyj committed Nov 14, 2024
2 parents 89add6d + 6784053 commit d25d2c1
Show file tree
Hide file tree
Showing 85 changed files with 2,475 additions and 868 deletions.
9 changes: 9 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@
"console": "integratedTerminal",
"sourceMaps": true
},
{
"type": "node",
"name": "Current Unit Tests (Jest)",
"request": "launch",
"runtimeArgs": ["--inspect-brk", "${workspaceFolder}/node_modules/jest/bin/jest", "-i", "${fileBasenameNoExtension}"],
"cwd": "${workspaceFolder}/packages/zowe-explorer",
"console": "integratedTerminal",
"sourceMaps": true
},
{
"type": "node",
"name": "API Unit Tests (Jest)",
Expand Down
4 changes: 4 additions & 0 deletions packages/zowe-explorer-api/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,16 @@ All notable changes to the "zowe-explorer-api" extension will be documented in t

### Bug fixes

- Fixed an issue to review inconsistent capitalization across translation strings. [#2935](https://github.com/zowe/zowe-explorer-vscode/issues/2935)
- Fixed an issue where the `responseTimeout` profile property was ignored for z/OSMF MVS and USS API calls. [#3225](https://github.com/zowe/zowe-explorer-vscode/issues/3225)

## `3.0.2`

### New features and enhancements

- Zowe Explorer now includes support for the [VS Code display languages](https://code.visualstudio.com/docs/getstarted/locales) French, German, Japanese, Portuguese, and Spanish. [#3239](https://github.com/zowe/zowe-explorer-vscode/pull/3239)
- Localization of strings within the webviews. [#2983](https://github.com/zowe/zowe-explorer-vscode/issues/2983)
- Leverage the new error correlation facility to provide user-friendly summaries of API and network errors. Extenders can also contribute to the correlator to provide human-readable translations of error messages, as well as tips and additional resources for how to resolve the error. [#3243](https://github.com/zowe/zowe-explorer-vscode/pull/3243)

## `3.0.1`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import * as vscode from "vscode";
import { BaseProvider, ConflictViewSelection, DirEntry, FileEntry, ZoweScheme } from "../../../src/fs";
import { Gui } from "../../../src/globals";
import { MockedProperty } from "../../../__mocks__/mockUtils";
import { ErrorCorrelator, ZoweExplorerApiType } from "../../../src";

function getGlobalMocks(): { [key: string]: any } {
return {
Expand Down Expand Up @@ -542,6 +543,35 @@ describe("_handleConflict", () => {
expect(diffOverwriteMock).toHaveBeenCalledWith(globalMocks.testFileUri);
});
});
describe("_handleError", () => {
it("calls ErrorCorrelator.displayError to display error to user - no options provided", async () => {
const displayErrorMock = jest.spyOn(ErrorCorrelator.prototype, "displayError").mockReturnValue(new Promise((res, rej) => {}));
const prov = new (BaseProvider as any)();
prov._handleError(new Error("example"));
expect(displayErrorMock).toHaveBeenCalledWith(ZoweExplorerApiType.All, new Error("example"), {
additionalContext: undefined,
allowRetry: false,
profileType: "any",
templateArgs: undefined,
});
});
it("calls ErrorCorrelator.displayError to display error to user - options provided", async () => {
const displayErrorMock = jest.spyOn(ErrorCorrelator.prototype, "displayError").mockReturnValue(new Promise((res, rej) => {}));
const prov = new (BaseProvider as any)();
prov._handleError(new Error("example"), {
additionalContext: "Failed to list data sets",
apiType: ZoweExplorerApiType.Mvs,
profileType: "zosmf",
templateArgs: {},
});
expect(displayErrorMock).toHaveBeenCalledWith(ZoweExplorerApiType.Mvs, new Error("example"), {
additionalContext: "Failed to list data sets",
allowRetry: false,
profileType: "zosmf",
templateArgs: {},
});
});
});

describe("_relocateEntry", () => {
it("returns early if the entry does not exist in the file system", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,21 @@ describe("ProfilesCache", () => {
expect(profCache.getAllTypes()).toEqual([...profileTypes, "ssh", "base"]);
});

it("should refresh profile data for existing profile and keep object reference", async () => {
const profCache = new ProfilesCache(fakeLogger as unknown as imperative.Logger);
const profInfoSpy = jest.spyOn(profCache, "getProfileInfo").mockResolvedValue(createProfInfoMock([lpar1Profile, zftpProfile]));
await profCache.refresh(fakeApiRegister as unknown as Types.IApiRegisterClient);
expect(profCache.allProfiles.length).toEqual(2);
expect(profCache.allProfiles[0]).toMatchObject(lpar1Profile);
const oldZosmfProfile = profCache.allProfiles[0];
const newZosmfProfile = { ...lpar1Profile, profile: lpar2Profile.profile };
profInfoSpy.mockResolvedValue(createProfInfoMock([newZosmfProfile, zftpProfile]));
await profCache.refresh(fakeApiRegister as unknown as Types.IApiRegisterClient);
expect(profCache.allProfiles.length).toEqual(2);
expect(profCache.allProfiles[0]).toMatchObject(newZosmfProfile);
expect(oldZosmfProfile.profile).toEqual(newZosmfProfile.profile);
});

it("should refresh profile data for and merge tokens with base profile", async () => {
const profCache = new ProfilesCache(fakeLogger as unknown as imperative.Logger);
jest.spyOn(profCache, "getProfileInfo").mockResolvedValue(
Expand Down
Loading

0 comments on commit d25d2c1

Please sign in to comment.