From 528d6d86bd204329b537f5f2327f57f51149fa78 Mon Sep 17 00:00:00 2001 From: Trae Yelovich Date: Wed, 11 Dec 2024 11:21:47 -0500 Subject: [PATCH] test: update refreshUSS test to verify dispose is always called Signed-off-by: Trae Yelovich --- packages/zowe-explorer/__tests__/__mocks__/vscode.ts | 4 ++++ .../__tests__/__unit__/trees/uss/USSInit.unit.test.ts | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/packages/zowe-explorer/__tests__/__mocks__/vscode.ts b/packages/zowe-explorer/__tests__/__mocks__/vscode.ts index be4fcc7a8e..2f1501a2dc 100644 --- a/packages/zowe-explorer/__tests__/__mocks__/vscode.ts +++ b/packages/zowe-explorer/__tests__/__mocks__/vscode.ts @@ -842,6 +842,10 @@ export class Disposable { * @param callOnDispose Function that disposes something. */ constructor() {} + /** + * Dispose this object. + */ + public dispose(): any {} } export function RelativePattern(base: string, pattern: string) { diff --git a/packages/zowe-explorer/__tests__/__unit__/trees/uss/USSInit.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/trees/uss/USSInit.unit.test.ts index ef2045d76b..b7819c3882 100644 --- a/packages/zowe-explorer/__tests__/__unit__/trees/uss/USSInit.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/trees/uss/USSInit.unit.test.ts @@ -16,6 +16,7 @@ import { SharedContext } from "../../../../src/trees/shared/SharedContext"; import { USSInit } from "../../../../src/trees/uss/USSInit"; import { SharedActions } from "../../../../src/trees/shared/SharedActions"; import { SharedInit } from "../../../../src/trees/shared/SharedInit"; +import { Gui } from "@zowe/zowe-explorer-api"; describe("Test src/uss/extension", () => { describe("initUSSProvider", () => { @@ -26,6 +27,7 @@ describe("Test src/uss/extension", () => { context: { subscriptions: new Array() }, value: { test: "uss", refreshUSS: jest.fn(), openUSS: jest.fn(), deleteUSSNode: jest.fn(), getUSSDocumentFilePath: jest.fn() }, _: { _: "_" }, + statusMsg: { dispose: jest.fn() }, }; const ussFileProvider: { [key: string]: jest.Mock } = { createZoweSession: jest.fn(), @@ -52,6 +54,8 @@ describe("Test src/uss/extension", () => { mock: [ { spy: jest.spyOn(SharedContext, "isDocument"), arg: [test.value], ret: true }, { spy: jest.spyOn(SharedContext, "isUssDirectory"), arg: [test.value], ret: false }, + { spy: jest.spyOn(Gui, "setStatusBarMessage"), arg: ["$(sync~spin) Pulling from Mainframe..."], ret: test.statusMsg }, + { spy: jest.spyOn(test.statusMsg, "dispose"), arg: [] }, ], }, {