diff --git a/packages/zowe-explorer/__tests__/__unit__/dataset/ZoweDatasetNode.unit.test.ts b/packages/zowe-explorer/__tests__/__unit__/dataset/ZoweDatasetNode.unit.test.ts index 500b8c93b1..17d8ed6d8b 100644 --- a/packages/zowe-explorer/__tests__/__unit__/dataset/ZoweDatasetNode.unit.test.ts +++ b/packages/zowe-explorer/__tests__/__unit__/dataset/ZoweDatasetNode.unit.test.ts @@ -445,7 +445,7 @@ describe("ZoweDatasetNode Unit Tests - function datasetRecalled", () => { contextOverride: globals.DS_MIGRATED_FILE_CONTEXT, profile: createIProfile(), }); - await (ZoweDatasetNode as any).datasetRecalled(dsNode, true); + await (dsNode as any).datasetRecalled(true); expect(dsNode.collapsibleState).toBe(vscode.TreeItemCollapsibleState.Collapsed); }); @@ -456,7 +456,7 @@ describe("ZoweDatasetNode Unit Tests - function datasetRecalled", () => { contextOverride: globals.DS_MIGRATED_FILE_CONTEXT, profile: createIProfile(), }); - await (ZoweDatasetNode as any).datasetRecalled(dsNode, true); + await (dsNode as any).datasetRecalled(true); expect(dsNode.iconPath).toBe(getIconById(IconId.folder).path); }); @@ -467,7 +467,7 @@ describe("ZoweDatasetNode Unit Tests - function datasetRecalled", () => { contextOverride: globals.DS_MIGRATED_FILE_CONTEXT, profile: createIProfile(), }); - await (ZoweDatasetNode as any).datasetRecalled(dsNode, false); + await (dsNode as any).datasetRecalled(false); expect(dsNode.iconPath).toBe(getIconById(IconId.document).path); }); }); @@ -480,7 +480,7 @@ describe("ZoweDatasetNode Unit Tests - function datasetMigrated", () => { contextOverride: globals.DS_PDS_CONTEXT, profile: createIProfile(), }); - (ZoweDatasetNode as any).datasetMigrated(dsNode, true); + (dsNode as any).datasetMigrated(); expect(dsNode.collapsibleState).toBe(vscode.TreeItemCollapsibleState.None); }); @@ -492,7 +492,7 @@ describe("ZoweDatasetNode Unit Tests - function datasetMigrated", () => { parentNode: createDatasetSessionNode(createISession(), createIProfile()), profile: createIProfile(), }); - (ZoweDatasetNode as any).datasetMigrated(dsNode); + (dsNode as any).datasetMigrated(); expect(dsNode.resourceUri).toBeUndefined(); expect(dsNode.command).toBeUndefined(); }); @@ -504,7 +504,7 @@ describe("ZoweDatasetNode Unit Tests - function datasetMigrated", () => { contextOverride: globals.DS_MIGRATED_FILE_CONTEXT, profile: createIProfile(), }); - (ZoweDatasetNode as any).datasetMigrated(dsNode); + (dsNode as any).datasetMigrated(); expect(dsNode.iconPath).toBe(getIconById(IconId.migrated).path); }); }); diff --git a/packages/zowe-explorer/src/dataset/ZoweDatasetNode.ts b/packages/zowe-explorer/src/dataset/ZoweDatasetNode.ts index de04cec39a..1f5f4014f6 100644 --- a/packages/zowe-explorer/src/dataset/ZoweDatasetNode.ts +++ b/packages/zowe-explorer/src/dataset/ZoweDatasetNode.ts @@ -135,16 +135,16 @@ export class ZoweDatasetNode extends ZoweTreeNode implements IZoweDatasetTreeNod * Updates an existing data set node that was recalled so it can be interacted with. * @param node The data set node to update (previously marked as migrated) */ - private static datasetRecalled(node: ZoweDatasetNode, isPds: boolean): void { + private datasetRecalled(isPds: boolean): void { // Change context value to match dsorg, update collapsible state and assign resource URI - node.contextValue = isPds ? globals.DS_PDS_CONTEXT : globals.DS_DS_CONTEXT; - node.collapsibleState = - node.contextValue === globals.DS_PDS_CONTEXT ? vscode.TreeItemCollapsibleState.Collapsed : vscode.TreeItemCollapsibleState.None; + this.contextValue = isPds ? globals.DS_PDS_CONTEXT : globals.DS_DS_CONTEXT; + this.collapsibleState = + this.contextValue === globals.DS_PDS_CONTEXT ? vscode.TreeItemCollapsibleState.Collapsed : vscode.TreeItemCollapsibleState.None; // Replace icon on existing node with new one - const icon = getIconByNode(node); + const icon = getIconByNode(this); if (icon) { - node.setIcon(icon.path); + this.setIcon(icon.path); } } @@ -152,18 +152,18 @@ export class ZoweDatasetNode extends ZoweTreeNode implements IZoweDatasetTreeNod * Updates a data set node so it is marked as migrated. * @param node The data set node to mark as migrated */ - private static datasetMigrated(node: ZoweDatasetNode): void { + private datasetMigrated(): void { // Change the context value and collapsible state to represent a migrated data set - node.contextValue = globals.DS_MIGRATED_FILE_CONTEXT; - node.collapsibleState = vscode.TreeItemCollapsibleState.None; + this.contextValue = globals.DS_MIGRATED_FILE_CONTEXT; + this.collapsibleState = vscode.TreeItemCollapsibleState.None; // Remove the node's command - node.command = undefined; + this.command = undefined; // Assign migrated icon to the data set node - const icon = getIconByNode(node); + const icon = getIconByNode(this); if (icon) { - node.setIcon(icon.path); + this.setIcon(icon.path); } } @@ -219,9 +219,9 @@ export class ZoweDatasetNode extends ZoweTreeNode implements IZoweDatasetTreeNod const existing = this.children.find((element) => element.label.toString() === dsEntry); if (existing) { if (contextually.isMigrated(existing) && item.migr?.toUpperCase() !== "YES") { - ZoweDatasetNode.datasetRecalled(existing, item.dsorg === "PO" || item.dsorg === "PO-E"); + existing.datasetRecalled(item.dsorg === "PO" || item.dsorg === "PO-E"); } else if (!contextually.isMigrated(existing) && item.migr?.toUpperCase() === "YES") { - ZoweDatasetNode.datasetMigrated(existing); + existing.datasetMigrated(); } existing.updateStats(item); elementChildren[existing.label.toString()] = existing;