Skip to content

Commit

Permalink
small modifications for quality
Browse files Browse the repository at this point in the history
Signed-off-by: ATorrise <[email protected]>
  • Loading branch information
ATorrise committed Sep 12, 2024
1 parent e3898b5 commit 1503ea9
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,14 @@ describe("Delete Data Set", () => {
});

it("should delete a data set with --quiet flag", async () => {
let response = runCliScript(__dirname + "/__scripts__/command/command_create_data_set.sh",
let createResponse = runCliScript(__dirname + '/__scripts__/command/command_create_data_set.sh',
TEST_ENVIRONMENT, [dsname]);
response = runCliScript(__dirname + "/__scripts__/command/command_delete_data_set.sh",
expect(createResponse.status).toBe(0); // Ensure the data set is created successfully

// Now delete the data set, verify no output in quiet mode
let deleteResponse = runCliScript(__dirname + "/__scripts__/command/command_delete_data_set.sh",
TEST_ENVIRONMENT, [dsname, "--for-sure", "--quiet"]);
expect(response.stderr.toString()).toBe("");
expect(response.status).toBe(0);
expect(deleteResponse.stderr.toString()).toBe("");
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,6 @@ describe("Delete VSAM Data Set", () => {
});

it("should delete a VSAM data set that has a retention period", async () => {
let response = runCliScript(__dirname + "/__scripts__/command/command_invoke_ams_define_for_statement.sh",
TEST_ENVIRONMENT, [dsname, volume]);
response = runCliScript(__dirname + "/__scripts__/command/command_delete_vsam_data_set.sh",
TEST_ENVIRONMENT, [dsname, "--for-sure", "--purge"]);
expect(response.stderr.toString()).toBe("");
Expand All @@ -129,13 +127,17 @@ describe("Delete VSAM Data Set", () => {
});

it("should successfully delete a VSAM data set with --quiet flag", async () => {
let response = runCliScript(__dirname + "/__scripts__/command/command_invoke_ams_define_statement.sh",
// create vsam
let createResponse = runCliScript(__dirname + "/__scripts__/command/command_invoke_ams_define_statement.sh",
TEST_ENVIRONMENT, [dsname, volume]);
response = runCliScript(__dirname + "/__scripts__/command/command_delete_vsam_data_set.sh",
expect(createResponse.status).toBe(0);

// now delete
let deleteResponse = runCliScript(__dirname + "/__scripts__/command/command_delete_vsam_data_set.sh",
TEST_ENVIRONMENT, [dsname, "--for-sure", "--quiet"]);
expect(response.stderr.toString()).toBe("");
expect(response.status).toBe(0);
expect(response.stdout.toString()).toMatchSnapshot();
expect(deleteResponse.stderr.toString()).toBe("");
expect(deleteResponse.status).toBe(0);
expect(deleteResponse.stdout.toString()).toMatchSnapshot();
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,16 +115,18 @@ describe("Delete z/OS File System", () => {
});

it("should delete a ZFS with --quiet flag", async () => {
let response = runCliScript(__dirname + "/__scripts__/command/command_create_zfs.sh",
// first create zfs
let createResponse = runCliScript(__dirname + "/__scripts__/command/command_create_zfs.sh",
TEST_ENVIRONMENT, [fsname, volume]);
expect(createResponse.status).toBe(0);

response = runCliScript(__dirname + "/__scripts__/command/command_delete_zfs.sh",
let deleteResponse = runCliScript(__dirname + "/__scripts__/command/command_delete_zfs.sh",
TEST_ENVIRONMENT, [fsname, "--for-sure", "--quiet"]);

expect(response.stderr.toString()).toBe("");
expect(response.status).toBe(0);
expect(response.stdout.toString()).toMatchSnapshot();
expect(deleteResponse.stderr.toString()).toBe("");
expect(deleteResponse.status).toBe(0);
expect(deleteResponse.stdout.toString()).toMatchSnapshot();
});

});

describe("Expected failures", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe("ZfsHandler", () => {
});
deleteZfsSpy = jest.spyOn(Delete, "zfs");
deleteZfsSpy.mockClear();
deleteZfsSpy.mockImplementation(async () => defaultReturn);
deleteZfsSpy.mockImplementationOnce(async () => defaultReturn);
});

it("should call Delete.zfs", async () => {
Expand Down Expand Up @@ -66,7 +66,7 @@ describe("ZfsHandler", () => {
});

it("should return success: true when --quiet (-fq) flag is used and file is not found", async () => {
deleteZfsSpy.mockImplementation(() => {
deleteZfsSpy.mockImplementationOnce(() => {
throw fileNotFoundError;
});

Expand Down

0 comments on commit 1503ea9

Please sign in to comment.