Skip to content

Commit

Permalink
address gh code scanning comments
Browse files Browse the repository at this point in the history
Signed-off-by: zFernand0 <37381190+zFernand0@users.noreply.github.com>
  • Loading branch information
zFernand0 committed Jul 26, 2023
1 parent ad4b7e8 commit b5cbee9
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions packages/core/__tests__/auth/__unit__/Logout.apiml.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ describe("Auth Logout APIML unit tests", () => {

it("should be able to catch 401 errors from apimlLogout", async () => {
const runTest = async (errorString: string): Promise<ImperativeError> => {
ZosmfRestClient.prototype.request = jest.fn(async () => { throw new Error(errorString) });
ZosmfRestClient.prototype.request = jest.fn(async () => { throw new Error(errorString); });
let caughtError;
try {
await Logout.apimlLogout(fakeSession);
Expand All @@ -96,15 +96,13 @@ describe("Auth Logout APIML unit tests", () => {
expect(caughtError.message).toContain(realErrorText);
expect(caughtError instanceof ImperativeError).toEqual(true);
return caughtError;
}
};
// Token is invalid (logged out bu tnot expired)
let caughtError = await runTest("org.zowe.apiml.security.query.invalidToken");
expect(await runTest("org.zowe.apiml.security.query.invalidToken")).toBeDefined();
// Token is expored (old token)
caughtError = await runTest("org.zowe.apiml.security.expiredToken");
expect(await runTest("org.zowe.apiml.security.expiredToken")).toBeDefined();
// Token is not APIML token
caughtError = await runTest("org.zowe.apiml.security.query.tokenNotProvided");

expect(caughtError).toBeDefined();
expect(await runTest("org.zowe.apiml.security.query.tokenNotProvided")).toBeDefined();
});
});

Expand Down

0 comments on commit b5cbee9

Please sign in to comment.