Skip to content

Commit 54cbfa9

Browse files
updated code to get correct view not dummy view
1 parent b43d147 commit 54cbfa9

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/test/utils/utils.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ export async function createView(
2323
export async function createTree(
2424
view: SideBarView | undefined
2525
): Promise<CustomTreeSection | undefined> {
26-
return (await view
27-
?.getContent()
28-
.getSection("Checkmarx One Results")) as CustomTreeSection;
26+
const content = view?.getContent();
27+
if (!content) return undefined;
28+
return await content.getSection<CustomTreeSection>("Checkmarx One Results", CustomTreeSection);
2929
}
3030

3131
export async function initialize(): Promise<CustomTreeSection | undefined> {
@@ -49,9 +49,9 @@ export async function initializeSCA(): Promise<CustomTreeSection | undefined> {
4949
export async function createTreeSCA(
5050
view: SideBarView | undefined
5151
): Promise<CustomTreeSection | undefined> {
52-
return (await view
53-
?.getContent()
54-
.getSection("Checkmarx SCA Realtime Scanner")) as CustomTreeSection;
52+
const content = view?.getContent();
53+
if (!content) return undefined;
54+
return await content.getSection<CustomTreeSection>("Checkmarx SCA Realtime Scanner", CustomTreeSection);
5555
}
5656

5757
export async function quickPickSelector(input: InputBox) {

0 commit comments

Comments
 (0)