Skip to content
This repository has been archived by the owner on Nov 13, 2023. It is now read-only.

Commit

Permalink
reworking to
Browse files Browse the repository at this point in the history
Signed-off-by: Amber Torrise <112635587+ATorrise@users.noreply.github.com>
  • Loading branch information
ATorrise committed Jul 31, 2023
1 parent 0de219e commit 3c040c0
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ All notable changes to the Imperative package will be documented in this file.

## Recent Changes

- Enhancement: Added `offSchema` property for ProfileInfo to indicate if argument is a known schema argument [#899](https://github.com/zowe/imperative/issues/899)
- Enhancement: Added `inSchema` property for ProfileInfo to indicate if argument is a known schema argument [#899](https://github.com/zowe/imperative/issues/899)

## `5.16.0`

Expand Down
18 changes: 9 additions & 9 deletions packages/config/__tests__/ProfileInfo.TeamConfig.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -753,25 +753,25 @@ describe("TeamConfig ProfileInfo tests", () => {
}
});

it("should find correct offSchema args", async () => {
it("should find correct inSchema args", async () => {
const profInfo = createNewProfInfo(teamProjDir);
await profInfo.readProfilesFromDisk();
const profAttrs = profInfo.getAllProfiles()[7] as IProfAttrs;
const mergedArgs = profInfo.mergeArgsForProfile(profAttrs);

const expectedArgs = [
{ argName: "host", offSchema: false },
{ argName: "port", offSchema: false },
{ argName: "responseFormatHeader", offSchema: true },
{ argName: "fakeOffSchemaArg", offSchema: true },
{ argName: "user", offSchema: false },
{ argName: "password", offSchema: false },
{ argName: "rejectUnauthorized", offSchema: false },
{ argName: "host", inSchema: true },
{ argName: "port", inSchema: true },
{ argName: "responseFormatHeader", inSchema: false },
{ argName: "fakeOffSchemaArg", inSchema: false },
{ argName: "user", inSchema: true },
{ argName: "password", inSchema: true },
{ argName: "rejectUnauthorized", inSchema: true },
];

expect(mergedArgs.knownArgs.length).toBe(expectedArgs.length);
for (const [idx, arg] of mergedArgs.knownArgs.entries()) {
expect(arg.offSchema).toEqual(expectedArgs[idx].offSchema);
expect(arg.inSchema).toEqual(expectedArgs[idx].inSchema);
}
});

Expand Down
10 changes: 5 additions & 5 deletions packages/config/src/ProfileInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ export class ProfileInfo {
argValue: propVal,
argLoc,
secure,
offSchema: true
inSchema: false
});
}
}
Expand Down Expand Up @@ -656,7 +656,7 @@ export class ProfileInfo {
argValue: propVal,
argLoc,
secure,
offSchema: true
inSchema: false
});
}
}
Expand Down Expand Up @@ -748,7 +748,7 @@ export class ProfileInfo {
dataType: this.argDataType(propInfoInSchema.type),
argValue: (propInfoInSchema as ICommandProfileProperty).optionDefinition?.defaultValue,
argLoc,
offSchema: false,
inSchema: true,
// See https://github.com/zowe/imperative/issues/739
secure: foundInSecureArray || propInfoInSchema.secure
};
Expand All @@ -763,15 +763,15 @@ export class ProfileInfo {
if (!argFound) {
mergedArgs.missingArgs.push({
argName: propName,
offSchema: false,
inSchema: true,
dataType: this.argDataType(propInfoInSchema.type),
argValue: (propInfoInSchema as ICommandProfileProperty).optionDefinition?.defaultValue,
argLoc: { locType: ProfLocType.DEFAULT },
secure: propInfoInSchema.secure
});
}
} else {
knownArg.offSchema = false;
knownArg.inSchema = true;
knownArg.secure = knownArg.secure ?? propInfoInSchema.secure;
if (knownArg.secure) {
delete knownArg.argValue;
Expand Down
2 changes: 1 addition & 1 deletion packages/config/src/doc/IProfArgAttrs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ export interface IProfArgAttrs {
secure?: boolean;

/** Whether the argument value is defined in the schema file */
offSchema?: boolean;
inSchema?: boolean;
}

0 comments on commit 3c040c0

Please sign in to comment.