Skip to content

Commit

Permalink
Add condition to initialization test
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew W. Harn <[email protected]>
  • Loading branch information
awharn committed Jun 15, 2023
1 parent c6d40dc commit 8b76178
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import * as path from "path";
import * as zowe from "@zowe/cli";
import { ProfilesCache } from "../../../src/profiles/ProfilesCache";
import { ZoweExplorerApi } from "../../../src";
import { getSecurityModules } from "../../../src/security/KeytarCredentialManager";
jest.mock("../../../src/security/KeytarCredentialManager");

jest.mock("fs");
jest.mock("@zowe/cli", () => {
Expand Down Expand Up @@ -124,6 +126,7 @@ describe("ProfilesCache", () => {
const fakeLogger = { debug: jest.fn() };
const fakeZoweDir = zowe.getZoweDir();
const readProfilesFromDiskSpy = jest.spyOn(zowe.imperative.ProfileInfo.prototype, "readProfilesFromDisk");
const defaultCredMgrWithKeytarSpy = jest.spyOn(zowe.imperative.ProfileCredentials, "defaultCredMgrWithKeytar");

afterEach(() => {
jest.clearAllMocks();
Expand All @@ -132,6 +135,7 @@ describe("ProfilesCache", () => {
it("getProfileInfo should initialize ProfileInfo API", async () => {
const profInfo = await new ProfilesCache(fakeLogger as unknown as zowe.imperative.Logger, __dirname).getProfileInfo();
expect(readProfilesFromDiskSpy).toHaveBeenCalledTimes(1);
expect(defaultCredMgrWithKeytarSpy).toHaveBeenCalledTimes(1);
const teamConfig = profInfo.getTeamConfig();
expect(teamConfig.appName).toBe("zowe");
expect(teamConfig.paths).toEqual([
Expand Down

0 comments on commit 8b76178

Please sign in to comment.