Skip to content

Commit

Permalink
updated code coverage
Browse files Browse the repository at this point in the history
Signed-off-by: Pujal <[email protected]>
  • Loading branch information
pujal0909 committed Dec 13, 2024
1 parent fcde3f1 commit 85611f5
Showing 1 changed file with 25 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -575,32 +575,48 @@ describe("Copy", () => {
};

it("should detect PDS datasets correctly during copy", async () => {
let caughtError;
let response;
listDatasetSpy.mockImplementation(async (): Promise<any> => {
return {
apiResponse: {
items: [dsPO]
}
};
});
const response = await Copy.isPDS(dummySession, dsPO.dsname);
try {
response = await Copy.isPDS(dummySession, dsPO.dsname);
}
catch(e) {
caughtError = e;

Check warning

Code scanning / CodeQL

Useless assignment to local variable Warning test

The value assigned to caughtError here is unused.
}
expect(response).toEqual(true);
expect(listDatasetSpy).toHaveBeenCalledWith(dummySession, dsPO.dsname, { attributes: true });
});

it("should return false if the data set is not partitioned", async () => {
let response;
let caughtError;
listDatasetSpy.mockImplementation(async (): Promise<any> => {
return {
apiResponse: {
items: [dsPS]
}
};
});
const response = await Copy.isPDS(dummySession, dsPS.dsname);
try {
response = await Copy.isPDS(dummySession, dsPS.dsname);
}
catch(e) {
caughtError = e;

Check warning

Code scanning / CodeQL

Useless assignment to local variable Warning test

The value assigned to caughtError here is unused.
}
expect(response).toEqual(false);
expect(listDatasetSpy).toHaveBeenCalledWith(dummySession, dsPS.dsname, { attributes: true });
});

it("should successfully copy members from source to target PDS", async () => {
let caughtError;
let response;
const sourceResponse = {
apiResponse: {
items: [
Expand All @@ -619,7 +635,13 @@ describe("Copy", () => {
uploadSpy.mockResolvedValue(undefined);
rmSync.mockImplementation(jest.fn());

const response = await Copy.copyPDS(dummySession, fromDataSetName, toDataSetName);

try{
response = await Copy.copyPDS(dummySession, fromDataSetName, toDataSetName);
}
catch(e) {
caughtError = e;

Check warning

Code scanning / CodeQL

Useless assignment to local variable Warning test

The value assigned to caughtError here is unused.
}
expect(listAllMembersSpy).toHaveBeenCalledWith(dummySession, fromDataSetName);
expect(downloadAllMembersSpy).toHaveBeenCalledWith(dummySession, fromDataSetName, expect.any(Object));
expect(fileListPathSpy).toHaveBeenCalled();
Expand Down

0 comments on commit 85611f5

Please sign in to comment.