-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into submit-jcl-enhancements
Signed-off-by: Billie Simmons <[email protected]>
- Loading branch information
Showing
7 changed files
with
244 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
43 changes: 43 additions & 0 deletions
43
packages/zowe-explorer/__tests__/__unit__/shared/TreeProvider.unit.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/** | ||
* This program and the accompanying materials are made available under the terms of the | ||
* Eclipse Public License v2.0 which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-v20.html | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Copyright Contributors to the Zowe Project. | ||
* | ||
*/ | ||
|
||
import { createTreeView } from "../../../__mocks__/mockCreators/shared"; | ||
import { TreeProviders } from "../../../src/shared/TreeProviders"; | ||
|
||
describe("TreeProvider Unit Tests - Function getters", () => { | ||
it("should retrieve the ds provider", async () => { | ||
const mockTree = createTreeView("ds"); | ||
await TreeProviders.initializeProviders({} as any, { | ||
ds: jest.fn(() => mockTree) as any, | ||
uss: jest.fn(), | ||
job: jest.fn(), | ||
}); | ||
expect(TreeProviders.ds).toEqual(mockTree); | ||
}); | ||
it("should retrieve the uss provider", async () => { | ||
const mockTree = createTreeView("uss"); | ||
await TreeProviders.initializeProviders({} as any, { | ||
ds: jest.fn(), | ||
uss: jest.fn(() => mockTree) as any, | ||
job: jest.fn(), | ||
}); | ||
expect(TreeProviders.uss).toEqual(mockTree); | ||
}); | ||
it("should retrieve the uss provider", async () => { | ||
const mockTree = createTreeView("job"); | ||
await TreeProviders.initializeProviders({} as any, { | ||
ds: jest.fn(), | ||
uss: jest.fn(), | ||
job: jest.fn(() => mockTree) as any, | ||
}); | ||
expect(TreeProviders.job).toEqual(mockTree); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/** | ||
* This program and the accompanying materials are made available under the terms of the | ||
* Eclipse Public License v2.0 which accompanies this distribution, and is available at | ||
* https://www.eclipse.org/legal/epl-v20.html | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Copyright Contributors to the Zowe Project. | ||
* | ||
*/ | ||
|
||
import * as vscode from "vscode"; | ||
import { IZoweTree, IZoweTreeNode } from "@zowe/zowe-explorer-api"; | ||
import { IZoweProviders } from "./init"; | ||
|
||
type ProviderFunction = (context: vscode.ExtensionContext) => Promise<IZoweTree<IZoweTreeNode>>; | ||
export class TreeProviders { | ||
static #ds: IZoweTree<IZoweTreeNode>; | ||
static #uss: IZoweTree<IZoweTreeNode>; | ||
static #job: IZoweTree<IZoweTreeNode>; | ||
|
||
public static async initializeProviders( | ||
context: vscode.ExtensionContext, | ||
initializers: { ds: ProviderFunction; uss: ProviderFunction; job: ProviderFunction } | ||
): Promise<IZoweProviders> { | ||
TreeProviders.#ds = await initializers.ds(context); | ||
TreeProviders.#uss = await initializers.uss(context); | ||
TreeProviders.#job = await initializers.job(context); | ||
return TreeProviders.providers; | ||
} | ||
|
||
public static get ds(): IZoweTree<IZoweTreeNode> { | ||
return TreeProviders.#ds; | ||
} | ||
|
||
public static get uss(): IZoweTree<IZoweTreeNode> { | ||
return TreeProviders.#uss; | ||
} | ||
|
||
public static get job(): IZoweTree<IZoweTreeNode> { | ||
return TreeProviders.#job; | ||
} | ||
|
||
public static get providers(): IZoweProviders { | ||
return { | ||
ds: TreeProviders.#ds, | ||
uss: TreeProviders.#uss, | ||
job: TreeProviders.#job, | ||
}; | ||
} | ||
} |