From 3ad016410cdb4d9eac0b2998b56929b19e4cf4a9 Mon Sep 17 00:00:00 2001 From: Trae Yelovich Date: Wed, 11 Dec 2024 11:31:25 -0500 Subject: [PATCH] tests: cases for data set saveFile function Signed-off-by: Trae Yelovich --- .../__tests__/__unit__/dataset/actions.unit.test.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/zowe-explorer/__tests__/__unit__/dataset/actions.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/dataset/actions.unit.test.ts index 638f417153..7b019df14b 100644 --- a/packages/zowe-explorer/__tests__/__unit__/dataset/actions.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/dataset/actions.unit.test.ts @@ -43,6 +43,7 @@ import { getNodeLabels } from "../../../src/dataset/utils"; import { ZoweLogger } from "../../../src/utils/LoggerUtils"; import { mocked } from "../../../__mocks__/mockUtils"; import { LocalFileManagement } from "../../../src/utils/LocalFileManagement"; +import * as workspaceUtils from "../../../src/utils/workspace"; // Missing the definition of path module, because I need the original logic for tests jest.mock("fs"); @@ -1073,6 +1074,7 @@ describe("Dataset Actions Unit Tests - Function saveFile", () => { profileInstance, testDatasetTree, uploadContentSpy, + handleAutoSaveOnError: jest.spyOn(workspaceUtils, "handleAutoSaveOnError").mockImplementation(), }; } @@ -1238,6 +1240,7 @@ describe("Dataset Actions Unit Tests - Function saveFile", () => { (testDocument as any).fileName = path.join(globals.DS_DIR, testDocument.fileName); await dsActions.saveFile(testDocument, blockMocks.testDatasetTree); + expect(blockMocks.handleAutoSaveOnError).toHaveBeenCalled(); expect(globalMocks.concatChildNodes).toBeCalled(); expect(mocked(Gui.errorMessage)).toBeCalledWith("failed");