Skip to content

Commit

Permalink
Add unit tests for type info feature
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Moogk <[email protected]>
  • Loading branch information
petermoogk committed Nov 19, 2024
1 parent 4411c08 commit cc78331
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1023,6 +1023,22 @@ describe("USSTree Unit Tests - Function addSingleSession", () => {
expect(blockMocks.testTree.mSessionNodes.length).toEqual(2);
});

it("Tests that addSingleSession adds type info to the session", async () => {
const dsTree = new DatasetTree();
const profile1 = await createIProfile();

profile1.name = "test1Profile";

await dsTree.addSingleSession(profile1);

const sessionNode = dsTree.mSessionNodes.find((tNode) => tNode.label?.toString() === profile1.name)

expect(sessionNode).toBeDefined();

const context = sessionNode?.contextValue;
expect(context).toContain("_type=zosmf");
});

it("Tests that addSingleSession successfully adds a session", async () => {
await createGlobalMocks();
const blockMocks = await createBlockMocks();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,25 @@ describe("ZosJobsProvider unit tests - Function getChildren", () => {
return newMocks;
}

it("Tests that addSingleSession adds type info to the session", async () => {
const globalMocks = await createGlobalMocks();
const blockMocks = createBlockMocks(globalMocks);
mocked(vscode.window.createTreeView).mockReturnValueOnce(blockMocks.treeView);
const jobTree = new JobTree();
const profile1 = await createIProfile();

profile1.name = "test1Profile";

await jobTree.addSingleSession(profile1);

const sessionNode = jobTree.mSessionNodes.find((tNode) => tNode.label?.toString() === profile1.name)

expect(sessionNode).toBeDefined();

const context = sessionNode?.contextValue;
expect(context).toContain("_type=zosmf");
});

it("Tests that getChildren returns the Favorites and sessions when called at the root node", async () => {
const globalMocks = await createGlobalMocks();
const blockMocks = createBlockMocks(globalMocks);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1178,6 +1178,22 @@ describe("USSTree Unit Tests - Function addSingleSession", () => {
expect(globalMocks.testTree.mSessionNodes.length).toEqual(2);
});

it("Tests that addSingleSession adds type info to the session", async () => {
const ussTree = new USSTree();
const profile1 = await createIProfile();

profile1.name = "test1Profile";

await ussTree.addSingleSession(profile1);

const sessionNode = ussTree.mSessionNodes.find((tNode) => tNode.label?.toString() === profile1.name)

expect(sessionNode).toBeDefined();

const context = sessionNode?.contextValue;
expect(context).toContain("_type=zosmf");
});

it("Tests that addSingleSession successfully adds a session", async () => {
const globalMocks = createGlobalMocks();

Expand Down

0 comments on commit cc78331

Please sign in to comment.