Skip to content

Commit

Permalink
add more coverage and address unused imports
Browse files Browse the repository at this point in the history
Signed-off-by: Billie Simmons <[email protected]>
  • Loading branch information
JillieBeanSim committed Oct 9, 2023
1 parent b54abe3 commit 91f8db1
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

import * as vscode from "vscode";
import * as zowe from "@zowe/cli";
import * as unixActions from "../../../src/uss/actions";
import { Gui, ValidProfileEnum } from "@zowe/zowe-explorer-api";
import { ZoweExplorerApiRegister } from "../../../src/ZoweExplorerApiRegister";
import { Profiles } from "../../../src/Profiles";
Expand All @@ -32,7 +31,6 @@ import * as path from "path";
import * as workspaceUtils from "../../../src/utils/workspace";
import * as globals from "../../../src/globals";
import * as ussUtils from "../../../src/uss/utils";
import { ZoweLogger } from "../../../src/utils/LoggerUtils";
import { ZoweLocalStorage } from "../../../src/utils/ZoweLocalStorage";
import { LocalFileManagement } from "../../../src/utils/LocalFileManagement";
jest.mock("fs");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ import { ZoweLocalStorage } from "../../../src/utils/ZoweLocalStorage";
import * as wsUtils from "../../../src/utils/workspace";
import * as context from "../../../src/shared/context";
import { AttributeView } from "../../../src/uss/AttributeView";
import { LocalFileManagement } from "../../../src/utils/LocalFileManagement";

jest.mock("../../../src/utils/LoggerUtils");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import * as unixActions from "../../../src/uss/actions";
import * as dsActions from "../../../src/dataset/actions";
import { LocalFileManagement } from "../../../src/utils/LocalFileManagement";
import * as utils from "../../../src/shared/utils";
import { ZoweLogger } from "../../../src/globals";

jest.mock("fs");
jest.mock("vscode");
Expand Down Expand Up @@ -77,5 +78,20 @@ describe("LocalFileManagement unit tests", () => {
expect(mocks.mockDlUnixSpy).toBeCalledTimes(2);
expect(mocks.mockDlDsSpy).not.toBeCalled();
});
it("should log warning and return", async () => {
const mocks = createGlobalMocks();
mocks.mockFilesToCompare = [mocks.mockDsFileNode, mocks.mockDsFileNode];
Object.defineProperty(globals, "filesToCompare", { value: mocks.mockFilesToCompare, configurable: true });
mocks.mockIsDsNode = false;
Object.defineProperty(utils, "isZoweDatasetTreeNode", { value: jest.fn().mockReturnValue(mocks.mockIsDsNode), configurable: true });
mocks.mockIsUnixNode = false;
Object.defineProperty(utils, "isZoweUSSTreeNode", { value: jest.fn().mockReturnValue(mocks.mockIsUnixNode), configurable: true });
Object.defineProperty(ZoweLogger, "warn", { value: jest.fn(), configurable: true });
const logSpy = jest.spyOn(ZoweLogger, "warn");
await LocalFileManagement.compareChosenFileContent();
expect(mocks.mockDlUnixSpy).not.toBeCalled();
expect(mocks.mockDlDsSpy).not.toBeCalled();
expect(logSpy).toBeCalled();
});
});
});

0 comments on commit 91f8db1

Please sign in to comment.