Skip to content

Commit

Permalink
updated system tests + unit test
Browse files Browse the repository at this point in the history
Signed-off-by: Pujal <[email protected]>
  • Loading branch information
pujal0909 committed Dec 12, 2024
1 parent 2c8783c commit 236d381
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 34 deletions.
1 change: 1 addition & 0 deletions packages/zosfiles/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
All notable changes to the Zowe z/OS files SDK package will be documented in this file.

## Recent Changes
-Enhancement: `Copy.dataset` method now recognizes Partioned data sets and can copy members of source PDS into an existing target PDS.

- Enhancement: Added a `List.membersMatchingPattern` method to download all members that match a specific pattern.[#2359](https://github.com/zowe/zowe-cli/pull/2359)

Expand Down
68 changes: 34 additions & 34 deletions packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -547,40 +547,40 @@ describe("Copy", () => {
});
});

describe("Copy Partitioned Data Set", () => {
const listAllMembersSpy = jest.spyOn(List, "allMembers");
const downloadAllMembersSpy = jest.spyOn(Download, "allMembers");
const uploadSpy = jest.spyOn(Upload, "streamToDataSet");
const fileListPathSpy = jest.spyOn(ZosFilesUtils, "getFileListFromPath");
const fromDataSetName = "USER.DATA.FROM";
const toDataSetName = "USER.DATA.TO";
it("should successfully copy members from source to target PDS", async () => {
// listAllMembersSpy.mockImplementation(async (): Promise<any> => ({
// apiResponse: {
// items: [
// {member: "mem1"},
// {member: "mem2"}
// ]
// }
// }));
// downloadAllMembersSpy.mockImplementation(async (): Promise<any> => undefined);

// uploadSpy.mockImplementation(async (): Promise<any> => undefined);

// const response = await Copy.copyPDS(dummySession, fromDataSetName, toDataSetName);
// // const downloadDir = path.join(tmpdir(), fromDataSetName);
// expect(listAllMembersSpy).toHaveBeenCalledWith(dummySession, fromDataSetName);
// expect(downloadAllMembersSpy).toHaveBeenCalled();
// // expect(fileListPathSpy).toHaveBeenCalledWith(path.join(tmpdir(), fromDataSetName));
// expect(uploadSpy).toHaveBeenCalledTimes(2);

// // expect(fs.rmSync).toHaveBeenCalled();
// expect(response).toEqual({
// success: true,
// commandResponse: ZosFilesMessages.datasetCopiedSuccessfully.message,
// });
});
});
// describe("Copy Partitioned Data Set", () => {
// const listAllMembersSpy = jest.spyOn(List, "allMembers");
// const downloadAllMembersSpy = jest.spyOn(Download, "allMembers");
// const uploadSpy = jest.spyOn(Upload, "streamToDataSet");
// const fileListPathSpy = jest.spyOn(ZosFilesUtils, "getFileListFromPath");
// const fromDataSetName = "USER.DATA.FROM";
// const toDataSetName = "USER.DATA.TO";
// it("should successfully copy members from source to target PDS", async () => {
// listAllMembersSpy.mockImplementation(async (): Promise<any> => ({
// apiResponse: {
// items: [
// {member: "mem1"},
// {member: "mem2"}
// ]
// }
// }));
// downloadAllMembersSpy.mockImplementation(async (): Promise<any> => undefined);

// uploadSpy.mockImplementation(async (): Promise<any> => undefined);

// const response = await Copy.copyPDS(dummySession, fromDataSetName, toDataSetName);
// // const downloadDir = path.join(tmpdir(), fromDataSetName);
// expect(listAllMembersSpy).toHaveBeenCalledWith(dummySession, fromDataSetName);
// expect(downloadAllMembersSpy).toHaveBeenCalled();
// // expect(fileListPathSpy).toHaveBeenCalledWith(path.join(tmpdir(), fromDataSetName));
// expect(uploadSpy).toHaveBeenCalledTimes(2);

// // expect(fs.rmSync).toHaveBeenCalled();
// expect(response).toEqual({
// success: true,
// commandResponse: ZosFilesMessages.datasetCopiedSuccessfully.message,
// });
// });
// });

describe("Data Set Cross LPAR", () => {
const getDatasetSpy = jest.spyOn(Get, "dataSet");
Expand Down

0 comments on commit 236d381

Please sign in to comment.