Skip to content

Commit 7627b25

Browse files
committed
updated unit test for coverage
Signed-off-by: Pujal <[email protected]>
1 parent b353d93 commit 7627b25

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

packages/zowe-explorer/__tests__/__mocks__/@zowe/imperative.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,9 +264,9 @@ export class ImperativeError extends Error {
264264
public get details() {
265265
return this.mDetails;
266266
}
267-
// public get errorCode() {
268-
// return this.mDetails.errorCode;
269-
// }
267+
public get errorCode() {
268+
return this.mDetails.errorCode;
269+
}
270270
}
271271

272272
export class ProfInfoErr extends ImperativeError {

packages/zowe-explorer/__tests__/__unit__/trees/uss/UssFSProvider.unit.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -516,17 +516,17 @@ describe("UssFSProvider", () => {
516516
expect(_updateResourceInEditorMock).toHaveBeenCalledWith(testUris.file);
517517
autoDetectEncodingMock.mockRestore();
518518
});
519-
it("returns null when a 401 error is encountered", async () => {
519+
it("returns null when an error that is not 401 is encountered", async () => {
520520
const fileEntry = { ...testEntries.file };
521521
jest.spyOn((UssFSProvider as any).prototype, "_lookupAsFile").mockReturnValueOnce(fileEntry);
522522
const autoDetectEncodingMock = jest.spyOn(UssFSProvider.instance, "autoDetectEncoding").mockImplementation();
523-
const error401 = new imperative.ImperativeError({
523+
const error404 = new imperative.ImperativeError({
524524
msg: "Username or password are not valid or expired",
525-
errorCode: `${imperative.RestConstants.HTTP_STATUS_401}`,
525+
errorCode: `${imperative.RestConstants.HTTP_STATUS_404}`,
526526
});
527527
const loggerErrorSpy = jest.spyOn(ZoweLogger, "error");
528528
jest.spyOn(ZoweExplorerApiRegister, "getUssApi").mockReturnValueOnce({
529-
getContents: jest.fn().mockRejectedValue(error401),
529+
getContents: jest.fn().mockRejectedValue(error404),
530530
} as any);
531531

532532
const result = await UssFSProvider.instance.fetchFileAtUri(testUris.file);

0 commit comments

Comments
 (0)