Skip to content

Commit

Permalink
Remove unused function
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgenherje committed Oct 9, 2023
1 parent f716e79 commit 4cbe645
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,6 @@ export function createAndAddNode(treeNodeDataList: TreeDataNode[], nodeName: str
return newNode;
}

export function findOrCreateNode(treeNodeDataList: TreeDataNode[], nodeName: string, icon?: string): TreeDataNode {
const existingNode = treeNodeDataList.find((node) => node.name === nodeName);
if (existingNode) {
return existingNode;
}

return createAndAddNode(treeNodeDataList, nodeName, icon);
}

export function createTreeDataNodeListFromParameters(
parameters: Parameter[],
checkIcon?: string,
Expand All @@ -50,7 +41,7 @@ export function createTreeDataNodeListFromParameters(
createAndAddNode(treeDataNodeList, ParameterParentNodeNames.IS_LINEAR, checkIcon);
}

// Add name parameters and check for group name
// Add parameter name and check for group name
const parameterNameSet = new Set<string>();
const groupNameSet = new Set<string>();
for (const parameter of parameters) {
Expand Down
16 changes: 0 additions & 16 deletions frontend/tests/unit-tests/ParameterListFilterUtils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { ContinuousParameter, DiscreteParameter, ParameterType } from "@framewor
import {
createAndAddNode,
createTreeDataNodeListFromParameters,
findOrCreateNode,
getChildNodeNamesFromParentNodeName,
getParametersMatchingSelectedNodes,
} from "@framework/components/ParameterListFilter/private-utils/smartNodeSelectorUtils";
Expand Down Expand Up @@ -48,21 +47,6 @@ describe("Test of utility functions for ParameterListFilter", () => {
expect(newNode.name).toBe(myTestList[0].name);
});

test("Test find node", () => {
const testNode = { name: "my node", description: "", icon: undefined };
const testNodes: TreeDataNode[] = [testNode];
const foundNode = findOrCreateNode(testNodes, "my node");
expect(foundNode.name).toBe("my node");
expect(testNodes.length).toBe(1);
});

test("Test create node", () => {
const testNodes: TreeDataNode[] = [];
const createdNode = findOrCreateNode(testNodes, "my node");
expect(createdNode.name).toBe("my node");
expect(testNodes.length).toBe(1);
});

test("Create tree data node list from parameters", () => {
const parameterList = [CONTINUOUS_PARAMETER, DISCRETE_PARAMETER];
const testNodes = createTreeDataNodeListFromParameters(parameterList);
Expand Down

0 comments on commit 4cbe645

Please sign in to comment.