Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating icons for disabled and closed statuses resources #207

6 changes: 5 additions & 1 deletion packages/vsce/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@

All notable changes to the "cics-extension-for-zowe" extension will be documented in this file.

## Recent Changes

- Updated status icons for local transactions, local files, tasks and programs. [#203](https://github.com/zowe/cics-for-zowe-client/issues/203)

## `3.3.0`

- Added `Manage Profile` option for CICS profiles. [#179](https://github.com/zowe/cics-for-zowe-client/issues/179)

## `3.2.6`

- BugFix: Inform user no resources found when filtering trees. [#200](https://github.com/zowe/cics-for-zowe-client/issues/200)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import CustomError from "../../__utils__/CustomError";
jest.mock("@zowe/cics-for-zowe-sdk");
const zoweSdk = require("@zowe/cics-for-zowe-sdk");

jest.mock("../../../src/utils/profileUtils", () => {
jest.mock("../../../src/utils/iconUtils", () => {
return { getIconOpen: getIconOpenMock };
});
jest.mock("../../../src/trees/treeItems/CICSProgramTreeItem");
Expand Down
108 changes: 108 additions & 0 deletions packages/vsce/__tests__/__unit__/utils/iconUtils.unit.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
import { getIconByStatus, getIconOpen, getIconPathInResources, getIconRootName } from "../../../src/utils/iconUtils";

const iconPath = {
light: "program-dark.svg",
dark: "program-light.svg",
};

describe("Test suite for iconUtils", () => {
describe("Test suite for getIconPathResources", () => {
it("Should return icon path for dark and light theme", () => {
const result = getIconPathInResources("program");
expect(result.dark).toContain(iconPath.dark);
expect(result.light).toContain(iconPath.light);
});
});

describe("Test suite for getIconOpen", () => {
it("Should return icon path for folder open when true", () => {
const result = getIconOpen(true);
expect(result.dark).toContain("folder-open-light");
expect(result.light).toContain("folder-open-dark");
});
it("Should return icon path for folder closed when false", () => {
const result = getIconOpen(false);
expect(result.dark).toContain("folder-closed-light");
expect(result.light).toContain("folder-closed-dark");
});
});

describe("Test suite for getIconRootName", () => {
// Using the common object for resourcesTreeItem
const resourceTreeItem = {
status: "",
openstatus: "",
enablestatus: "",
runstatus: "",
};
it("Should return program-disabled for PROGRAM resource with DISABLED status", () => {
resourceTreeItem.status = "DISABLED";
const result = getIconRootName("PROGRAM", resourceTreeItem);
expect(result).toBe("program-disabled");
});
it("Should return program for PROGRAM resource with ENABLED status", () => {
resourceTreeItem.status = "ENABLED";
const result = getIconRootName("PROGRAM", resourceTreeItem);
expect(result).toBe("program");
});
it("Should return local-transaction-disabled for TRANSACTION resource with DISABLED status", () => {
resourceTreeItem.status = "DISABLED";
const result = getIconRootName("TRANSACTION", resourceTreeItem);
expect(result).toBe("local-transaction-disabled");
});
it("Should return local-transaction for TRANSACTION resource with ENABLED status", () => {
resourceTreeItem.status = "ENABLED";
const result = getIconRootName("TRANSACTION", resourceTreeItem);
expect(result).toBe("local-transaction");
});
it("Should return local-file-disabled-closed for LOCAL_FILE resource with openstatus as CLOSED and enablestatus as CLOSED", () => {
resourceTreeItem.openstatus = "CLOSED";
resourceTreeItem.enablestatus = "DISABLED";
const result = getIconRootName("LOCAL_FILE", resourceTreeItem);
expect(result).toBe("local-file-disabled-closed");
});
it("Should return local-file-closed for LOCAL_FILE resource with openstatus as CLOSED", () => {
resourceTreeItem.enablestatus = "ENABLED";
resourceTreeItem.openstatus = "CLOSED";
const result = getIconRootName("LOCAL_FILE", resourceTreeItem);
expect(result).toBe("local-file-closed");
});
it("Should return local-file-disabled for LOCAL_FILE resource with enablestatus as DISABLED", () => {
resourceTreeItem.openstatus = "OPEN";
resourceTreeItem.enablestatus = "DISABLED";
const result = getIconRootName("LOCAL_FILE", resourceTreeItem);
expect(result).toBe("local-file-disabled");
});
it("Should return local-file for LOCAL_FILE resource with enablestatus as ENABLED and openstatus as OPEM", () => {
resourceTreeItem.enablestatus = "ENABLED";
resourceTreeItem.openstatus = "OPEN";
const result = getIconRootName("LOCAL_FILE", resourceTreeItem);
expect(result).toBe("local-file");
});
it("Should return task-running for TASK resource with runstatus as RUNNING", () => {
resourceTreeItem.runstatus = "RUNNING";
const result = getIconRootName("TASK", resourceTreeItem);
expect(result).toBe("task-running");
});
it("Should return task-suspended for TASK resource with runstatus as SUSPENDED", () => {
resourceTreeItem.runstatus = "SUSPENDED";
const result = getIconRootName("TASK", resourceTreeItem);
expect(result).toBe("task-suspended");
});
it("Should return task-dispatched for TASK resource with runstatus as DISPATCHED", () => {
resourceTreeItem.runstatus = "DISPATCHED";
const result = getIconRootName("TASK", resourceTreeItem);
expect(result).toBe("task-dispatched");
});
});

describe("Test suite for getIconByStatus", () => {
const resource = {
status: "DISABLED",
};
it("Should return icon based on resource status", () => {
const result = getIconByStatus("PROGRAM", resource);
expect(result.dark).toContain("program-disabled");
});
});
});
11 changes: 11 additions & 0 deletions packages/vsce/resources/imgs/local-file-closed-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions packages/vsce/resources/imgs/local-file-closed-light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions packages/vsce/resources/imgs/local-file-disabled-closed-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions packages/vsce/resources/imgs/local-file-disabled-closed-light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions packages/vsce/resources/imgs/local-file-disabled-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions packages/vsce/resources/imgs/local-file-disabled-light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions packages/vsce/resources/imgs/local-transaction-disabled-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions packages/vsce/resources/imgs/local-transaction-disabled-light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions packages/vsce/resources/imgs/program-disabled-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions packages/vsce/resources/imgs/program-disabled-light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 2 additions & 11 deletions packages/vsce/resources/imgs/task-dispatched-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 2 additions & 11 deletions packages/vsce/resources/imgs/task-dispatched-light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 1 addition & 2 deletions packages/vsce/resources/imgs/task-running-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 1 addition & 2 deletions packages/vsce/resources/imgs/task-running-light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading