|
11 | 11 |
|
12 | 12 | const getIconFilePathFromNameMock = jest.fn();
|
13 | 13 |
|
| 14 | +import { imperative } from "@zowe/zowe-explorer-api"; |
14 | 15 | import { CICSPlexTree } from "../../../src/trees/CICSPlexTree";
|
15 | 16 | import { CICSRegionTree } from "../../../src/trees/CICSRegionTree";
|
16 | 17 | import { CICSSessionTree } from "../../../src/trees/CICSSessionTree";
|
17 | 18 | import * as globalMocks from "../../__utils__/globalMocks";
|
18 | 19 |
|
| 20 | + |
19 | 21 | jest.mock("@zowe/zowe-explorer-api");
|
20 | 22 | jest.mock("../../../src/utils/iconUtils", () => {
|
21 | 23 | return { getIconFilePathFromName: getIconFilePathFromNameMock };
|
22 | 24 | });
|
23 |
| -const cicsTreeMock = jest.fn(); |
| 25 | +const cisutreeMock = jest.fn(); |
24 | 26 | const treeResourceMock = globalMocks.getDummyTreeResources("cicsmanagedregion", "fileName*");
|
25 | 27 | const profile = {
|
26 | 28 | profile: { user: "user", password: "pwd", hostname: "hostname", protocol: "https", type: "basic", rejectUnauthorized: false, port: 8080 },
|
27 | 29 | };
|
28 | 30 | describe("Test suite for CICSSessionTree", () => {
|
29 | 31 | let sut: CICSSessionTree;
|
| 32 | + let ses: imperative.Session; |
30 | 33 |
|
31 |
| - beforeEach(() => { |
32 |
| - getIconFilePathFromNameMock.mockReturnValue(treeResourceMock.iconPath); |
| 34 | + describe("Validation", () => { |
33 | 35 |
|
34 |
| - sut = new CICSSessionTree(profile); |
35 |
| - sut.isUnauthorized = true; |
36 |
| - expect(getIconFilePathFromNameMock).toHaveBeenCalledWith("profile-unverified"); |
37 |
| - }); |
| 36 | + beforeEach(() => { |
| 37 | + getIconFilePathFromNameMock.mockReturnValue(treeResourceMock.iconPath); |
38 | 38 |
|
39 |
| - afterEach(() => { |
40 |
| - jest.resetAllMocks(); |
41 |
| - }); |
| 39 | + sut = new CICSSessionTree(profile); |
| 40 | + sut.isUnauthorized = true; |
| 41 | + expect(getIconFilePathFromNameMock).toHaveBeenCalledWith("profile-unverified"); |
| 42 | + }); |
42 | 43 |
|
43 |
| - describe("Test suite for addRegion", () => { |
44 |
| - it("should push CICSRegionTree object into children", () => { |
45 |
| - sut.addRegion(cicsTreeMock as any as CICSRegionTree); |
46 |
| - expect(sut.getChildren().length).toBeGreaterThanOrEqual(1); |
| 44 | + afterEach(() => { |
| 45 | + jest.resetAllMocks(); |
47 | 46 | });
|
48 |
| - }); |
49 |
| - describe("Test suite for addPlex", () => { |
50 |
| - it("should push CICSPlexTree object into children", () => { |
51 |
| - sut.addPlex(cicsTreeMock as any as CICSPlexTree); |
52 |
| - expect(sut.getChildren().length).toBeGreaterThanOrEqual(1); |
| 47 | + |
| 48 | + describe("Test suite for addRegion", () => { |
| 49 | + it("should push CICSRegionTree object into children", () => { |
| 50 | + sut.addRegion(cisutreeMock as any as CICSRegionTree); |
| 51 | + expect(sut.getChildren().length).toBeGreaterThanOrEqual(1); |
| 52 | + }); |
53 | 53 | });
|
54 |
| - }); |
55 |
| - describe("Test suite for getChildren", () => { |
56 |
| - it("should return an array of childrens", () => { |
57 |
| - expect(sut.getChildren().length).toBeGreaterThanOrEqual(0); |
| 54 | + describe("Test suite for addPlex", () => { |
| 55 | + it("should push CICSPlexTree object into children", () => { |
| 56 | + sut.addPlex(cisutreeMock as any as CICSPlexTree); |
| 57 | + expect(sut.getChildren().length).toBeGreaterThanOrEqual(1); |
| 58 | + }); |
58 | 59 | });
|
59 |
| - }); |
60 |
| - describe("Test suite for setUnauthorized", () => { |
61 |
| - it("should set isUnauthorized to true", () => { |
62 |
| - sut.setUnauthorized(); |
63 |
| - expect(sut.isUnauthorized).toBeTruthy(); |
| 60 | + describe("Test suite for getChildren", () => { |
| 61 | + it("should return an array of childrens", () => { |
| 62 | + expect(sut.getChildren().length).toBeGreaterThanOrEqual(0); |
| 63 | + }); |
64 | 64 | });
|
65 |
| - }); |
66 |
| - describe("Test suite for setAuthorized", () => { |
67 |
| - it("should set isUnauthorized to false", () => { |
68 |
| - sut.setAuthorized(); |
69 |
| - expect(sut.isUnauthorized).toBeFalsy(); |
| 65 | + describe("Test suite for setUnauthorized", () => { |
| 66 | + it("should set isUnauthorized to true", () => { |
| 67 | + sut.setUnauthorized(); |
| 68 | + expect(sut.isUnauthorized).toBeTruthy(); |
| 69 | + }); |
70 | 70 | });
|
71 |
| - }); |
72 |
| - describe("Test suite for getIsUnauthorized", () => { |
73 |
| - it("should return the object of isUnauthorized", () => { |
74 |
| - expect(sut.getIsUnauthorized()).toBeTruthy(); |
| 71 | + describe("Test suite for setAuthorized", () => { |
| 72 | + it("should set isUnauthorized to false", () => { |
| 73 | + sut.setAuthorized(); |
| 74 | + expect(sut.isUnauthorized).toBeFalsy(); |
| 75 | + }); |
| 76 | + }); |
| 77 | + describe("Test suite for getIsUnauthorized", () => { |
| 78 | + it("should return the object of isUnauthorized", () => { |
| 79 | + expect(sut.getIsUnauthorized()).toBeTruthy(); |
| 80 | + }); |
75 | 81 | });
|
76 | 82 | });
|
77 | 83 | });
|
0 commit comments