diff --git a/packages/zowe-explorer/__tests__/__unit__/Profiles.extended.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/Profiles.extended.unit.test.ts index e610c7652f..fd4563e564 100644 --- a/packages/zowe-explorer/__tests__/__unit__/Profiles.extended.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/Profiles.extended.unit.test.ts @@ -292,41 +292,13 @@ describe("Profiles Unit Tests - Function createZoweSession", () => { hide: jest.fn(), value: "test", } as any); - jest.spyOn(Gui, "resolveQuickPick").mockResolvedValueOnce(new utils.FilterDescriptor("Test1")); - jest.spyOn(Gui, "resolveQuickPick").mockResolvedValueOnce(new utils.FilterDescriptor("Test2")); - jest.spyOn(Profiles.getInstance(), "getProfileInfo").mockResolvedValue({ - usingTeamConfig: false, - } as any); + jest.spyOn(Gui, "resolveQuickPick").mockResolvedValueOnce(new utils.FilterDescriptor("Test")); + jest.spyOn(Profiles.getInstance(), "getProfileInfo").mockResolvedValueOnce(createInstanceOfProfileInfo()); jest.spyOn(Gui, "showInputBox").mockResolvedValue("test"); - jest.spyOn(Profiles.getInstance(), "createNewConnection").mockResolvedValue("Test"); - const refreshSpy = jest.spyOn(Profiles.getInstance(), "refresh").mockImplementation(); - jest.spyOn(ProfileManagement, "handleChangeForAllTrees").mockResolvedValue(true); - jest.spyOn(TreeProviders, "providers", "get").mockReturnValue({ - ds: { addSingleSession: jest.fn(), mSessionNodes: [...globalMocks.testUSSTree.mSessionNodes], refresh: jest.fn() } as any, - uss: { addSingleSession: jest.fn(), mSessionNodes: [...globalMocks.testUSSTree.mSessionNodes], refresh: jest.fn() } as any, - jobs: { addSingleSession: jest.fn(), mSessionNodes: [...globalMocks.testUSSTree.mSessionNodes], refresh: jest.fn() } as any, - } as any); - await expect(Profiles.getInstance().createZoweSession(globalMocks.testUSSTree)).resolves.not.toThrow(); - expect(refreshSpy).toBeCalledTimes(1); - expect(spyInfo).toBeCalledWith("New profile created, test."); - refreshSpy.mockClear(); - spyInfo.mockClear(); - jest.spyOn(Gui, "resolveQuickPick").mockReset(); - }); - it("Tests that createZoweSession runs successfully and uses the chosenProfile", async () => { - const globalMocks = await createGlobalMocks(); - jest.spyOn(Gui, "createQuickPick").mockReturnValue({ - show: jest.fn(), - hide: jest.fn(), - value: "test", - } as any); - jest.spyOn(Gui, "resolveQuickPick").mockResolvedValueOnce({ label: "test" }); - const spyInfo = jest.spyOn(ZoweLogger, "info"); - jest.spyOn(ProfileManagement, "handleChangeForAllTrees").mockResolvedValue(true); await expect(Profiles.getInstance().createZoweSession(globalMocks.testUSSTree)).resolves.not.toThrow(); - expect(spyInfo).toBeCalledWith("The profile test has been added to the zowe.uss.history tree."); - spyInfo.mockClear(); + expect(spyConfig).toBeCalled(); + spyConfig.mockClear(); }); it("Tests that createZoweSession catches error and log warning", async () => {