From f2d031709d1f8b7fed6484fa6eb3a308a81997be Mon Sep 17 00:00:00 2001 From: Rudy Flores <68666202+rudyflores@users.noreply.github.com> Date: Mon, 30 Oct 2023 17:11:24 -0400 Subject: [PATCH] add missing coverage Signed-off-by: Rudy Flores <68666202+rudyflores@users.noreply.github.com> --- .../__unit__/utils/ProfilesUtils.unit.test.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/packages/zowe-explorer/__tests__/__unit__/utils/ProfilesUtils.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/utils/ProfilesUtils.unit.test.ts index 577228539d..6bd720ab07 100644 --- a/packages/zowe-explorer/__tests__/__unit__/utils/ProfilesUtils.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/utils/ProfilesUtils.unit.test.ts @@ -778,6 +778,23 @@ describe("ProfilesUtils unit tests", () => { expect(profUtils.ProfilesUtils.getCredentialManagerOverride()).toBe("My Custom Credential Manager"); expect(zoweLoggerTraceSpy).toBeCalledTimes(1); }); + + it("should return default manager if the override file does not exist", () => { + const zoweLoggerTraceSpy = jest.spyOn(ZoweLogger, "trace"); + const zoweLoggerInfoSpy = jest.spyOn(ZoweLogger, "info"); + + jest.spyOn(fs, "readFileSync").mockImplementation(() => { + throw new Error("test"); + }); + try { + profUtils.ProfilesUtils.getCredentialManagerOverride(); + } catch (err) { + expect(err).toBe("test"); + } + + expect(zoweLoggerTraceSpy).toBeCalledTimes(1); + expect(zoweLoggerInfoSpy).toBeCalledTimes(1); + }); }); describe("setupCustomCredentialManager", () => {