Skip to content

Commit

Permalink
updated changelogs - PR comments
Browse files Browse the repository at this point in the history
Signed-off-by: Pujal <pujal.gandhi@broadcom.com>
  • Loading branch information
pujal0909 committed Feb 25, 2025
1 parent ca27f0f commit f9436b5
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 57 deletions.
2 changes: 1 addition & 1 deletion packages/cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ All notable changes to the Zowe CLI package will be documented in this file.

## Recent Changes

- BugFix: When using the `copy` command, when a target partitioned data set has a smaller record length than a source partitioned data set, it no longer stops the operation for subsequent members. The user can now view the affected members in a local file. [#2349] (https://github.com/zowe/zowe-cli/issues/2349)
- BugFix: When using the `copy` command, if a target partitioned data set has a smaller record length than a source partitioned data set, the operation for subsequent members no longer stops. The user can now view the affected members in a local file. [#2349] (https://github.com/zowe/zowe-cli/issues/2349)
- BugFix: Users were not warned when copying partitioned data sets with identical member names. Now, the user is prompted to confirm before continuing the copy operation to avoid potential data loss. [#2349] (https://github.com/zowe/zowe-cli/issues/2349)

## `8.14.0`
Expand Down
2 changes: 1 addition & 1 deletion packages/zosfiles/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ All notable changes to the Zowe z/OS files SDK package will be documented in thi

## Recent Changes

- BugFix: When using the `copy` command, when a target partitioned data set has a smaller record length than a source partitioned data set, it no longer stops the operation for subsequent members. The user can now view the affected members in a local file. [#2349] (https://github.com/zowe/zowe-cli/issues/2349)
- BugFix: When using the `copy` command, if a target partitioned data set has a smaller record length than a source partitioned data set, the operation for subsequent members no longer stops. The user can now view the affected members in a local file. [#2349] (https://github.com/zowe/zowe-cli/issues/2349)
- BugFix: Users were not warned when copying partitioned data sets with identical member names. Now, the user is prompted to confirm before continuing the copy operation to avoid potential data loss. [#2349] (https://github.com/zowe/zowe-cli/issues/2349)

## `8.13.0`
Expand Down
76 changes: 21 additions & 55 deletions packages/zosfiles/__tests__/__unit__/methods/copy/Copy.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -475,14 +475,20 @@ describe("Copy", () => {
it("should not throw error if safeReplace has value of true", async () => {
promptFn.mockResolvedValue(true);

const startBar = jest.fn();
const endBar = jest.fn();
const mockProgress = { startBar, endBar};

const response = await Copy.dataSet(
dummySession,
{ dsn: toDataSetName },
{ "from-dataset": { dsn: fromDataSetName },
safeReplace: true,
promptFn }
promptFn,
progress: mockProgress }
);

expect(startBar).toHaveBeenCalled();
expect(endBar).toHaveBeenCalled();
expect(copyExpectStringSpy).toHaveBeenCalledTimes(1);
const argumentsOfCall = copyExpectStringSpy.mock.calls[0];
const lastArgumentOfCall = argumentsOfCall[argumentsOfCall.length - 1];
Expand All @@ -493,15 +499,20 @@ describe("Copy", () => {

it("should throw error if user declines to replace the dataset", async () => {
promptFn.mockResolvedValue(false);
const startBar = jest.fn();
const endBar = jest.fn();

Check notice

Code scanning / CodeQL

Unused variable, import, function or class Note test

Unused variable endBar.

await expect(Copy.dataSet(
dummySession,
{ dsn: toDataSetName },
{ "from-dataset": { dsn: fromDataSetName },
safeReplace: true,
promptFn }
promptFn,
progress: undefined}
)).rejects.toThrow(new ImperativeError({ msg: ZosFilesMessages.datasetCopiedAborted.message }));

expect(startBar).not.toHaveBeenCalled();
expect(startBar).not.toHaveBeenCalled();
expect(promptFn).toHaveBeenCalledWith(toDataSetName);

});
Expand All @@ -522,6 +533,9 @@ describe("Copy", () => {

});
describe("Partitioned > Partitioned", () => {
const startBar = jest.fn();
const endBar = jest.fn();
const mockProgress = { startBar, endBar};
let createSpy: jest.SpyInstance;
let dataSetExistsSpy: jest.SpyInstance;
const sourceResponse = {
Expand Down Expand Up @@ -555,8 +569,11 @@ describe("Copy", () => {
{dsn: toDataSetName},
{"from-dataset": {
dsn:fromDataSetName
}}
},
progress: mockProgress}
);
expect(startBar).toHaveBeenCalled();
expect(endBar).toHaveBeenCalled();
expect(isPDSSpy).toHaveBeenNthCalledWith(1, dummySession, fromDataSetName);
expect(isPDSSpy).toHaveBeenNthCalledWith(2, dummySession, toDataSetName);
expect(copyPDSSpy).toHaveBeenCalledTimes(1);
Expand Down Expand Up @@ -773,57 +790,6 @@ describe("Copy", () => {
});
});

describe('Copy Progress Bar Tests', () => {
let startBar: any;
let endBar: any;
let mockProgress: any;
const fromDataSetName = "USER.DATA.FROM";
const toDataSetName = "USER.DATA.TO";

beforeEach(() => {
startBar = jest.fn();
endBar = jest.fn();
mockProgress = { startBar, endBar};
});

it('scenario of where progress is provided', async () => {
const copyDataSetSpy = jest.spyOn(Copy, 'dataSet').mockResolvedValue({
success: true,
commandResponse: 'Dataset copied successfully',
});

await Copy.dataSet(dummySession, { dsn: toDataSetName },{
"from-dataset": { dsn: fromDataSetName },
progress: mockProgress
});

expect(copyDataSetSpy).toHaveBeenCalled();
expect(copyDataSetSpy).toHaveBeenCalledWith(dummySession, { dsn: toDataSetName }, expect.objectContaining({
progress: mockProgress
}));
});

it('scenario of where no progress is provided', async () => {
const copyDataSetSpy = jest.spyOn(Copy, 'dataSet').mockResolvedValue({
success: true,
commandResponse: 'Dataset copied successfully',
});

await Copy.dataSet(dummySession, { dsn: toDataSetName }, {
"from-dataset": { dsn: fromDataSetName },
progress: undefined
});

expect(startBar).not.toHaveBeenCalled();
expect(endBar).not.toHaveBeenCalled();
expect(copyDataSetSpy).toHaveBeenCalled();
expect(copyDataSetSpy).toHaveBeenCalledWith(dummySession, { dsn: toDataSetName }, expect.objectContaining({
progress: undefined
}));
});
});


describe("Partitioned Data Set", () => {
const listAllMembersSpy = jest.spyOn(List, "allMembers");
const downloadAllMembersSpy = jest.spyOn(Download, "allMembers");
Expand Down

0 comments on commit f9436b5

Please sign in to comment.