Skip to content

Commit

Permalink
format: add prettier
Browse files Browse the repository at this point in the history
Signed-off-by: zFernand0 <[email protected]>
  • Loading branch information
zFernand0 committed Mar 24, 2024
1 parent 08e7254 commit 27e51f4
Show file tree
Hide file tree
Showing 251 changed files with 3,806 additions and 3,137 deletions.
9 changes: 9 additions & 0 deletions .prettierrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
printWidth: 150
tabWidth: 2
useTabs: false
semi: true
singleQuote: false
trailingComma: "es5"
bracketSpacing: true
arrowParens: "always"
experimentalTernaries: true
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"lint": "npm run lint --workspaces",
"lintErrors": "npm run lintErrors --workspaces",
"prepare": "husky install",
"pretty": "turbo pretty",
"license": "node scripts/updateLicenses.js"
},
"devDependencies": {
Expand Down
18 changes: 9 additions & 9 deletions packages/cli/__mocks__/@zowe/cli-test-utils.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/*
* This program and the accompanying materials are made available under the terms of the
* Eclipse Public License v2.0 which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-v20.html
*
* SPDX-License-Identifier: EPL-2.0
*
* Copyright Contributors to the Zowe Project.
*
*/
* This program and the accompanying materials are made available under the terms of the
* Eclipse Public License v2.0 which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-v20.html
*
* SPDX-License-Identifier: EPL-2.0
*
* Copyright Contributors to the Zowe Project.
*
*/

const original = jest.requireActual("@zowe/cli-test-utils") as any;
const nodePath = require("path");
Expand Down
53 changes: 26 additions & 27 deletions packages/cli/__tests__/__src__/ITestPropertiesSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,58 +14,57 @@
* see example_properties.yaml for descriptions and more details
*/
export interface ITestPropertiesSchema {

/**
* Properties related to connecting to CICS service
*/
* Properties related to connecting to CICS service
*/
cics: {
/**
* user ID to connect to CMCI
*/
user: string,
* user ID to connect to CMCI
*/
user: string;
/**
* Password to connect to CMCI
*/
password: string,
* Password to connect to CMCI
*/
password: string;
/**
* host name for CMCI
*/
host: string,
* host name for CMCI
*/
host: string;
/**
* Port for CMCI
*/
port?: number,
* Port for CMCI
*/
port?: number;

/**
* http or https protocol for CMCI
*/
* http or https protocol for CMCI
*/
protocol?: string;

/**
* http or https protocol for CMCI
*/
* http or https protocol for CMCI
*/
rejectUnauthorized?: boolean;
};

/**
* Properties related to connecting to CMCI
*/
* Properties related to connecting to CMCI
*/
cmci: {
/**
* CSD group to define resources to
*/
* CSD group to define resources to
*/
csdGroup?: string;

/**
* Name of the CICS region e.g. "CICSCMCI"
*/
* Name of the CICS region e.g. "CICSCMCI"
*/
regionName?: string;
};

urimap: {
/**
* Name of the certificate to use for CICS Client Testing
*/
* Name of the certificate to use for CICS Client Testing
*/
certificate?: string;
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,11 @@ import { ITestPropertiesSchema } from "../../../__src__/ITestPropertiesSchema";

let TEST_ENVIRONMENT: ITestEnvironment<ITestPropertiesSchema>;
describe("CICS add-to-list csdGroup command", () => {

beforeAll(async () => {
TEST_ENVIRONMENT = await TestEnvironment.setUp({
testName: "add_to_list_csdGroup",
installPlugin: true,
tempProfileTypes: ["cics"]
tempProfileTypes: ["cics"],
});
});

Expand All @@ -35,8 +34,7 @@ describe("CICS add-to-list csdGroup command", () => {
});

it("should get a syntax error if csdGroup name is omitted", () => {
const output = runCliScript(__dirname + "/__scripts__/add_to_list_csdGroup.sh", TEST_ENVIRONMENT,
["", "FAKELIST", "FAKERGN"]);
const output = runCliScript(__dirname + "/__scripts__/add_to_list_csdGroup.sh", TEST_ENVIRONMENT, ["", "FAKELIST", "FAKERGN"]);
const stderr = output.stderr.toString();
expect(stderr).toContain("Syntax");
expect(stderr).toContain("Missing Positional Argument");
Expand All @@ -45,8 +43,7 @@ describe("CICS add-to-list csdGroup command", () => {
});

it("should get a syntax error if list name is omitted", () => {
const output = runCliScript(__dirname + "/__scripts__/add_to_list_csdGroup.sh", TEST_ENVIRONMENT,
["FAKEGRP", "", "FAKERGN"]);
const output = runCliScript(__dirname + "/__scripts__/add_to_list_csdGroup.sh", TEST_ENVIRONMENT, ["FAKEGRP", "", "FAKERGN"]);
const stderr = output.stderr.toString();
expect(stderr).toContain("Syntax");
expect(stderr).toContain("Missing Positional Argument");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,11 @@ let password: string;
let protocol: string;
let rejectUnauthorized: boolean;
describe("CICS define program command", () => {

beforeAll(async () => {
TEST_ENVIRONMENT = await TestEnvironment.setUp({
testName: "define_program",
installPlugin: true,
tempProfileTypes: ["cics"]
tempProfileTypes: ["cics"],
});
csdGroup = TEST_ENVIRONMENT.systemTestProperties.cmci.csdGroup;
regionName = TEST_ENVIRONMENT.systemTestProperties.cmci.regionName;
Expand All @@ -56,12 +55,14 @@ describe("CICS define program command", () => {
user: cicsProperties.user,
password: cicsProperties.password,
rejectUnauthorized: cicsProperties.rejectUnauthorized || false,
protocol: cicsProperties.protocol as any || "https",
protocol: (cicsProperties.protocol as any) || "https",
});

return CicsCmciRestClient.deleteExpectParsedXml(session,
return CicsCmciRestClient.deleteExpectParsedXml(
session,
`/${CicsCmciConstants.CICS_SYSTEM_MANAGEMENT}/CICSDefinitionProgram/${cmciProperties.regionName}` +
`?CRITERIA=(NAME=${programName})&PARAMETER=CSDGROUP(${cmciProperties.csdGroup})`);
`?CRITERIA=(NAME=${programName})&PARAMETER=CSDGROUP(${cmciProperties.csdGroup})`
);
};

it("should be able to display the help", () => {
Expand Down Expand Up @@ -102,21 +103,21 @@ describe("CICS define program command", () => {
it("should be able to successfully define a program using profile options", async () => {
const programNameSuffixLength = 4;
const programName = "DFN" + generateRandomAlphaNumericString(programNameSuffixLength);
const output = runCliScript(__dirname + "/__scripts__/define_program_fully_qualified.sh", TEST_ENVIRONMENT,
[programName,
csdGroup,
regionName,
host,
port,
user,
password,
protocol,
rejectUnauthorized]);
const output = runCliScript(__dirname + "/__scripts__/define_program_fully_qualified.sh", TEST_ENVIRONMENT, [
programName,
csdGroup,
regionName,
host,
port,
user,
password,
protocol,
rejectUnauthorized,
]);
const stderr = output.stderr.toString();
expect(stderr).toEqual("");
expect(output.status).toEqual(0);
expect(output.stdout.toString()).toContain("success");
await deleteProgram(programName);
});

});
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,11 @@ let password: string;
let protocol: string;
let rejectUnauthorized: boolean;
describe("CICS define transaction command", () => {

beforeAll(async () => {
TEST_ENVIRONMENT = await TestEnvironment.setUp({
testName: "define_transaction",
installPlugin: true,
tempProfileTypes: ["cics"]
tempProfileTypes: ["cics"],
});
csdGroup = TEST_ENVIRONMENT.systemTestProperties.cmci.csdGroup;
regionName = TEST_ENVIRONMENT.systemTestProperties.cmci.regionName;
Expand All @@ -56,12 +55,14 @@ describe("CICS define transaction command", () => {
user: cicsProperties.user,
password: cicsProperties.password,
rejectUnauthorized: cicsProperties.rejectUnauthorized || false,
protocol: cicsProperties.protocol as any || "https",
protocol: (cicsProperties.protocol as any) || "https",
});

return CicsCmciRestClient.deleteExpectParsedXml(session,
return CicsCmciRestClient.deleteExpectParsedXml(
session,
`/${CicsCmciConstants.CICS_SYSTEM_MANAGEMENT}/${CicsCmciConstants.CICS_DEFINITION_TRANSACTION}/${cmciProperties.regionName}` +
`?CRITERIA=(NAME=${transactionName})&PARAMETER=CSDGROUP(${cmciProperties.csdGroup})`);
`?CRITERIA=(NAME=${transactionName})&PARAMETER=CSDGROUP(${cmciProperties.csdGroup})`
);
};

it("should be able to display the help", () => {
Expand All @@ -75,8 +76,12 @@ describe("CICS define transaction command", () => {
const transactionNameSuffixLength = 3;
const transactionName = "X" + generateRandomAlphaNumericString(transactionNameSuffixLength);
const dummyPgmName = "TESTING";
const output = runCliScript(__dirname + "/__scripts__/define_transaction.sh", TEST_ENVIRONMENT,
[transactionName, dummyPgmName, csdGroup, regionName]);
const output = runCliScript(__dirname + "/__scripts__/define_transaction.sh", TEST_ENVIRONMENT, [
transactionName,
dummyPgmName,
csdGroup,
regionName,
]);
const stderr = output.stderr.toString();
expect(stderr).toEqual("");
expect(output.status).toEqual(0);
Expand All @@ -85,8 +90,7 @@ describe("CICS define transaction command", () => {
});

it("should get a syntax error if transaction name is omitted", () => {
const output = runCliScript(__dirname + "/__scripts__/define_transaction.sh", TEST_ENVIRONMENT,
["", "FAKEPGM", "FAKEGRP", "FAKERGN"]);
const output = runCliScript(__dirname + "/__scripts__/define_transaction.sh", TEST_ENVIRONMENT, ["", "FAKEPGM", "FAKEGRP", "FAKERGN"]);
const stderr = output.stderr.toString();
expect(stderr).toContain("Syntax");
expect(stderr).toContain("Missing Positional Argument");
Expand All @@ -95,8 +99,7 @@ describe("CICS define transaction command", () => {
});

it("should get a syntax error if program name is omitted", () => {
const output = runCliScript(__dirname + "/__scripts__/define_transaction.sh", TEST_ENVIRONMENT,
["FAKETRAN", "", "FAKEGRP", "FAKERGN"]);
const output = runCliScript(__dirname + "/__scripts__/define_transaction.sh", TEST_ENVIRONMENT, ["FAKETRAN", "", "FAKEGRP", "FAKERGN"]);
const stderr = output.stderr.toString();
expect(stderr).toContain("Syntax");
expect(stderr).toContain("Missing Positional Argument");
Expand All @@ -105,8 +108,7 @@ describe("CICS define transaction command", () => {
});

it("should get a syntax error if CSD group is omitted", () => {
const output = runCliScript(__dirname + "/__scripts__/define_transaction.sh", TEST_ENVIRONMENT,
["FAKETRAN", "FAKEPGM", "", "FAKERGN"]);
const output = runCliScript(__dirname + "/__scripts__/define_transaction.sh", TEST_ENVIRONMENT, ["FAKETRAN", "FAKEPGM", "", "FAKERGN"]);
const stderr = output.stderr.toString();
expect(stderr).toContain("Syntax");
expect(stderr).toContain("Missing Positional Argument");
Expand All @@ -118,17 +120,18 @@ describe("CICS define transaction command", () => {
const transactionNameSuffixLength = 3;
const transactionName = "X" + generateRandomAlphaNumericString(transactionNameSuffixLength);
const dummyPgmName = "TESTING";
const output = runCliScript(__dirname + "/__scripts__/define_transaction_fully_qualified.sh", TEST_ENVIRONMENT,
[transactionName,
dummyPgmName,
csdGroup,
regionName,
host,
port,
user,
password,
protocol,
rejectUnauthorized]);
const output = runCliScript(__dirname + "/__scripts__/define_transaction_fully_qualified.sh", TEST_ENVIRONMENT, [
transactionName,
dummyPgmName,
csdGroup,
regionName,
host,
port,
user,
password,
protocol,
rejectUnauthorized,
]);
const stderr = output.stderr.toString();
expect(stderr).toEqual("");
expect(output.status).toEqual(0);
Expand Down
Loading

0 comments on commit 27e51f4

Please sign in to comment.