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

Commit

Permalink
creating test for detecting correct offSchema values
Browse files Browse the repository at this point in the history
Signed-off-by: Amber Torrise <at895452@broadcom.net>
Signed-off-by: zFernand0 <37381190+zFernand0@users.noreply.github.com>
Signed-off-by: Amber Torrise <at895452@broadcom.net>
  • Loading branch information
Amber Torrise committed Jul 18, 2023
1 parent 12362fb commit 15aa180
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
22 changes: 22 additions & 0 deletions packages/config/__tests__/ProfileInfo.TeamConfig.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,28 @@ describe("TeamConfig ProfileInfo tests", () => {
}
});

it("should find correct offSchema 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 },
];

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

it("should throw if schema fails to load", async () => {
const profInfo = createNewProfInfo(teamProjDir);
await profInfo.readProfilesFromDisk();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,15 @@
"host": "LPAR4.your.domain.net",
"responseFormatHeader": true
}
},
"LPAR5": {
"type": "zosmf",
"properties": {
"host": "LPAR4.your.domain.net",
"port": 1234,
"responseFormatHeader": true,
"fakeOffSchemaArg": "fakeArg"
}
}
},
"defaults": {
Expand Down

0 comments on commit 15aa180

Please sign in to comment.