Update tests
This commit is contained in:
@@ -71,7 +71,7 @@ describe("ToolsTab", () => {
|
|||||||
// Switch to second tool
|
// Switch to second tool
|
||||||
rerender(
|
rerender(
|
||||||
<Tabs defaultValue="tools">
|
<Tabs defaultValue="tools">
|
||||||
<ToolsTab {...defaultProps} selectedTool={mockTools[1]} />
|
<ToolsTab {...defaultProps} selectedTool={mockTools[2]} />
|
||||||
</Tabs>,
|
</Tabs>,
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -82,25 +82,24 @@ describe("ToolsTab", () => {
|
|||||||
|
|
||||||
it("should handle integer type inputs", () => {
|
it("should handle integer type inputs", () => {
|
||||||
renderToolsTab({
|
renderToolsTab({
|
||||||
selectedTool: mockTools[2],
|
selectedTool: mockTools[1], // Use the tool with integer type
|
||||||
});
|
});
|
||||||
|
|
||||||
// Verify input is rendered as a number input
|
// Verify input is rendered as a number input
|
||||||
const input = screen.getByRole("spinbutton") as HTMLInputElement;
|
const input = screen.getByRole("spinbutton") as HTMLInputElement;
|
||||||
expect(input.type).toBe("text"); // This will fail - should be "number"
|
expect(input.type).toBe("number"); // Integer type should be treated as number
|
||||||
|
|
||||||
// Enter an integer value
|
// Enter an integer value
|
||||||
fireEvent.change(input, { target: { value: "42" } });
|
fireEvent.change(input, { target: { value: "42" } });
|
||||||
expect(input.value).toBe("42");
|
expect(input.value).toBe("42");
|
||||||
|
|
||||||
// Verify the callTool function receives the value as a number
|
// Verify the callTool function receives the value as a number
|
||||||
const submitButton = screen.getByRole("button", { name: /submit/i });
|
const submitButton = screen.getByRole("button", { name: /run tool/i });
|
||||||
fireEvent.click(submitButton);
|
fireEvent.click(submitButton);
|
||||||
|
|
||||||
expect(defaultProps.callTool).toHaveBeenCalledWith(
|
expect(defaultProps.callTool).toHaveBeenCalledWith(
|
||||||
mockTools[2].name,
|
mockTools[1].name,
|
||||||
{ count: 42 }, // Should be number 42, not string "42"
|
{ count: 42 }
|
||||||
expect.any(Function)
|
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user