Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
martmull committed Dec 14, 2024
1 parent 2ae2367 commit 5362593
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,22 @@ describe('getFunctionOutputSchema', () => {
e: [1, 2, 3],
};
const expectedOutputSchema = {
a: { isLeaf: true, type: 'unknown', value: null },
b: { isLeaf: true, type: 'string', value: 'b' },
a: { isLeaf: true, type: 'unknown', value: null, icon: 'IconVariable' },
b: { isLeaf: true, type: 'string', value: 'b', icon: 'IconVariable' },
c: {
isLeaf: false,
value: { cc: { isLeaf: true, type: 'number', value: 1 } },
icon: 'IconVariable',
value: {
cc: { isLeaf: true, type: 'number', value: 1, icon: 'IconVariable' },
},
},
d: { isLeaf: true, type: 'boolean', value: true, icon: 'IconVariable' },
e: {
isLeaf: true,
type: 'array',
value: [1, 2, 3],
icon: 'IconVariable',
},
d: { isLeaf: true, type: 'boolean', value: true },
e: { isLeaf: true, type: 'array', value: [1, 2, 3] },
};
expect(getFunctionOutputSchema(testResult)).toEqual(expectedOutputSchema);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ const wrapper = ({ children }: { children: React.ReactNode }) => (
);

describe('useTriggerNodeSelection', () => {
const mockUpdateNode = jest.fn();
const mockSetNodes = jest.fn();

beforeEach(() => {
(useReactFlow as jest.Mock).mockReturnValue({
updateNode: mockUpdateNode,
setNodes: mockSetNodes,
});
});

Expand Down Expand Up @@ -51,7 +51,6 @@ describe('useTriggerNodeSelection', () => {
result.current.setWorkflowDiagramTriggerNodeSelection(mockNodeId);
});

expect(mockUpdateNode).toHaveBeenCalledWith(mockNodeId, { selected: true });
expect(result.current.workflowDiagramTriggerNodeSelection).toBeUndefined();
});

Expand All @@ -61,6 +60,6 @@ describe('useTriggerNodeSelection', () => {
});

// Ensure updateNode is not called when state is undefined
expect(mockUpdateNode).not.toHaveBeenCalled();
expect(mockSetNodes).not.toHaveBeenCalled();
});
});

0 comments on commit 5362593

Please sign in to comment.