Skip to content

Commit

Permalink
test: update refreshUSS test to verify dispose is always called
Browse files Browse the repository at this point in the history
Signed-off-by: Trae Yelovich <[email protected]>
  • Loading branch information
traeok committed Dec 11, 2024
1 parent 8a44bc5 commit 528d6d8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/zowe-explorer/__tests__/__mocks__/vscode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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", () => {
Expand All @@ -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(),
Expand All @@ -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: [] },
],
},
{
Expand Down

0 comments on commit 528d6d8

Please sign in to comment.