Merging dev into main #49
@@ -79,7 +79,7 @@ export function PhaseReduce(node: Node, nodes: Node[]) {
|
|||||||
.map(([t]) => t);
|
.map(([t]) => t);
|
||||||
|
|
||||||
// children nodes - make sure to check for empty arrays
|
// children nodes - make sure to check for empty arrays
|
||||||
let childrenNodes: any[] = [];
|
let childrenNodes: Node[] = [];
|
||||||
if (data.children)
|
if (data.children)
|
||||||
childrenNodes = nodes.filter((node) => data.children.includes(node.id));
|
childrenNodes = nodes.filter((node) => data.children.includes(node.id));
|
||||||
|
|
||||||
|
|||||||
@@ -115,8 +115,8 @@ describe('NormNode', () => {
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
||||||
let norm = screen.getByText("Norm :")
|
const norm = screen.getByText("Norm :")
|
||||||
expect(norm).toBeInTheDocument;
|
expect(norm).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should render with dragging state', () => {
|
it('should render with dragging state', () => {
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ describe('PhaseNode', () => {
|
|||||||
expect(p1.data.children).toEqual(p2.data.children);
|
expect(p1.data.children).toEqual(p2.data.children);
|
||||||
|
|
||||||
// Add nodes to children
|
// Add nodes to children
|
||||||
let p1_data = p1.data as PhaseNodeData;
|
const p1_data = p1.data as PhaseNodeData;
|
||||||
let p2_data = p2.data as PhaseNodeData;
|
const p2_data = p2.data as PhaseNodeData;
|
||||||
p1_data.children.push("norm-1");
|
p1_data.children.push("norm-1");
|
||||||
p2_data.children.push("norm-2");
|
p2_data.children.push("norm-2");
|
||||||
p2_data.children.push("goal-1");
|
p2_data.children.push("goal-1");
|
||||||
|
|||||||
@@ -197,8 +197,14 @@ describe('TriggerNode', () => {
|
|||||||
const result = TriggerReduce(triggerNode, allNodes);
|
const result = TriggerReduce(triggerNode, allNodes);
|
||||||
|
|
||||||
expect(result).toEqual({
|
expect(result).toEqual({
|
||||||
label: 'Keyword Trigger',
|
id: "trigger-1",
|
||||||
list: [{ id: 'kw1', keyword: 'hello' }],
|
type: "keywords",
|
||||||
|
label: 'Keyword Trigger',
|
||||||
|
keywords: [
|
||||||
|
{
|
||||||
|
"id": "kw1",
|
||||||
|
"keyword": "hello",
|
||||||
|
},],
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -48,9 +48,10 @@ describe('NormNode', () => {
|
|||||||
test.each(getAllTypes())('it should render %s node with the default data', (nodeType) => {
|
test.each(getAllTypes())('it should render %s node with the default data', (nodeType) => {
|
||||||
const lengthBefore = screen.getAllByText(/.*/).length;
|
const lengthBefore = screen.getAllByText(/.*/).length;
|
||||||
|
|
||||||
let newNode = createNode(nodeType + "1", nodeType, {x: 200, y:200}, {})
|
const newNode = createNode(nodeType + "1", nodeType, {x: 200, y:200}, {})
|
||||||
let uiElement = Object.entries(NodeTypes).find(([t])=>t==nodeType)?.[1]!;
|
const uiElement = Object.entries(NodeTypes).find(([t])=>t==nodeType)?.[1];
|
||||||
let props = {
|
expect(uiElement).toBeDefined();
|
||||||
|
const props = {
|
||||||
id:newNode.id,
|
id:newNode.id,
|
||||||
type:newNode.type as string,
|
type:newNode.type as string,
|
||||||
data:newNode.data as any,
|
data:newNode.data as any,
|
||||||
|
|||||||
@@ -31,5 +31,3 @@ export function resetFlowStore() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Re-export everything from testing library
|
|
||||||
export * from '@testing-library/react';
|
|
||||||
Reference in New Issue
Block a user