Skip to content

Commit

Permalink
system tests, integration tests dont seem necessary
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 504a4f9 commit 31cabab
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ exports[`Delete Data Set Success scenarios should delete a partitioned data set
\\"message\\": \\"\\",
\\"stdout\\": \\"Data set deleted successfully.\\\\n\\",
\\"stderr\\": \\"\\",
\\"data\\": {
\\"success\\": true,
\\"commandResponse\\": \\"Data set deleted successfully.\\"
}
\\"data\\": {}
}"
`;

Expand All @@ -35,10 +32,7 @@ exports[`Delete Data Set Success scenarios should delete a partitioned data set
\\"message\\": \\"\\",
\\"stdout\\": \\"Data set deleted successfully.\\\\n\\",
\\"stderr\\": \\"\\",
\\"data\\": {
\\"success\\": true,
\\"commandResponse\\": \\"Data set deleted successfully.\\"
}
\\"data\\": {}
}"
`;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,15 @@ describe("Delete Data Set", () => {
runCliScript(__dirname + "/__scripts__/command/command_delete_data_set.sh",
TEST_ENVIRONMENT, [dsname, "--for-sure", "--rfj"]);
});

it("should delete a data set with --quiet flag", async () => {
let response = runCliScript(__dirname + "/__scripts__/command/command_create_data_set.sh",
TEST_ENVIRONMENT, [dsname]);

Check warning

Code scanning / CodeQL

Useless assignment to local variable Warning test

The initial value of response is unused, since it is always overwritten.
response = 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);
});
});

describe("Expected failures", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ USS File or directory deleted successfully.
"
`;

exports[`Delete File Success scenarios should delete a file with --quiet flag 1`] = `
"================Z/OS FILES DELETE FILE===============
USS File or directory deleted successfully.
"
`;

exports[`Delete File Success scenarios should delete a file with response timeout 1`] = `
"================Z/OS FILES DELETE FILE===============
USS File or directory deleted successfully.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,22 @@ describe("Delete File", () => {
expect(response.status).toBe(0);
expect(response.stdout.toString()).toMatchSnapshot();
});

it("should delete a file with response timeout", async () => {
const response = runCliScript(__dirname + "/__scripts__/command/command_delete_file.sh",
TEST_ENVIRONMENT, [ussname, "--for-sure", "--responseTimeout 5"]);
expect(response.stderr.toString()).toBe("");
expect(response.status).toBe(0);
expect(response.stdout.toString()).toMatchSnapshot();
});

it("should delete a file with --quiet flag", async () => {
const response = runCliScript(__dirname + "/__scripts__/command/command_delete_file.sh",
TEST_ENVIRONMENT, [ussname, "--for-sure", "--quiet"]);
expect(response.stderr.toString()).toBe("");
expect(response.status).toBe(0);
expect(response.stdout.toString()).toMatchSnapshot();
});
});

describe("Expected failures", () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ Data set deleted successfully.
"
`;

exports[`Delete VSAM Data Set Success scenarios should successfully delete a VSAM data set with --quiet flag 1`] = `
"================Z/OS FILES DELETE VSAM DATA SET===============
Data set deleted successfully.
"
`;

exports[`Delete VSAM Data Set without profiles should delete a data set 1`] = `
"Data set deleted successfully.
"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,16 @@ describe("Delete VSAM Data Set", () => {
expect(response.status).toBe(0);
expect(response.stdout.toString()).toMatchSnapshot();
});

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

Check warning

Code scanning / CodeQL

Useless assignment to local variable Warning test

The initial value of response is unused, since it is always overwritten.
response = 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();
});
});

describe("Expected failures", () => {
Expand All @@ -136,6 +146,15 @@ describe("Delete VSAM Data Set", () => {
expect(response.status).toBe(1);
expect(stripNewLines(response.stderr.toString())).toContain(`ENTRY ${user}.DOES.NOT.EXIST NOT DELETED`);
});
it("should fail deleting a non-existent data set without a --quiet flag", async () => {
// Attempt to delete a non-existent VSAM dataset without the --quiet flag
const response = runCliScript(__dirname + "/__scripts__/command/command_delete_vsam_data_set.sh",
TEST_ENVIRONMENT, [user + ".DOES.NOT.EXIST", "--for-sure"]);

// Check that stderr contains the expected error message about the dataset not being found
expect(response.status).toBe(1);
expect(stripNewLines(response.stderr.toString())).toContain(`ENTRY ${user}.DOES.NOT.EXIST NOT FOUND`);
});

it("should fail due to retention period not being exceeded", async () => {
let response = runCliScript(__dirname + "/__scripts__/command/command_invoke_ams_define_for_statement.sh",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ z/OS file system deleted successfully.
"
`;

exports[`Delete z/OS File System Success scenarios should delete a ZFS with --quiet flag 1`] = `
"================Z/OS FILES DELETE Z/OS FILE SYSTEM===============
z/OS file system deleted successfully.
"
`;

exports[`Delete z/OS File System Success scenarios should delete a ZFS with response timeout 1`] = `
"================Z/OS FILES DELETE Z/OS FILE SYSTEM===============
z/OS file system deleted successfully.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ describe("Delete z/OS File System", () => {
expect(response.status).toBe(0);
expect(response.stdout.toString()).toMatchSnapshot();
});

it("should delete a ZFS with response timeout", async () => {
let response = runCliScript(__dirname + "/__scripts__/command/command_create_zfs.sh",
TEST_ENVIRONMENT, [fsname, volume, "--responseTimeout 5"]);
Expand All @@ -112,6 +113,18 @@ describe("Delete z/OS File System", () => {
expect(response.status).toBe(0);
expect(response.stdout.toString()).toMatchSnapshot();
});

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

Check warning

Code scanning / CodeQL

Useless assignment to local variable Warning test

The initial value of response is unused, since it is always overwritten.

response = 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();
});
});

describe("Expected failures", () => {
Expand Down

0 comments on commit 31cabab

Please sign in to comment.