Skip to content

Commit

Permalink
tests: cases for data set saveFile function
Browse files Browse the repository at this point in the history
Signed-off-by: Trae Yelovich <[email protected]>
  • Loading branch information
traeok committed Dec 11, 2024
1 parent 62ed306 commit 3ad0164
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -1073,6 +1074,7 @@ describe("Dataset Actions Unit Tests - Function saveFile", () => {
profileInstance,
testDatasetTree,
uploadContentSpy,
handleAutoSaveOnError: jest.spyOn(workspaceUtils, "handleAutoSaveOnError").mockImplementation(),
};
}

Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit 3ad0164

Please sign in to comment.