mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-03-06 16:31:12 +08:00
fix(tests): add test for disabling all tools in CcwToolsMcpCard component
fix(api): handle empty enabledTools array and improve default tool logic fix(queueScheduler): ignore network errors in loadInitialState fix(auth): ensure token generation handles max session capacity chore(dependencies): update package requirements to use compatible version specifiers chore(tests): add new test cases for incremental indexer and migrations
This commit is contained in:
@@ -41,6 +41,43 @@ describe('CcwToolsMcpCard', () => {
|
||||
vi.clearAllMocks();
|
||||
});
|
||||
|
||||
it('disables all tools when clicking "Disable All" button', async () => {
|
||||
const { CcwToolsMcpCard } = await import('./CcwToolsMcpCard');
|
||||
const onUpdateConfigMock = vi.fn();
|
||||
|
||||
render(
|
||||
<CcwToolsMcpCard
|
||||
target="codex"
|
||||
isInstalled={true}
|
||||
enabledTools={['write_file', 'read_file', 'edit_file']}
|
||||
onToggleTool={vi.fn()}
|
||||
onUpdateConfig={onUpdateConfigMock}
|
||||
onInstall={vi.fn()}
|
||||
/>,
|
||||
{ locale: 'en' }
|
||||
);
|
||||
|
||||
const user = userEvent.setup();
|
||||
// Expand the card
|
||||
await act(async () => {
|
||||
await user.click(screen.getByText(/CCW MCP Server|mcp\.ccw\.title/i));
|
||||
});
|
||||
|
||||
// Find and click "Disable All" button
|
||||
const disableAllButton = screen.getByRole('button', {
|
||||
name: /Disable All|mcp\.ccw\.actions\.disableAll/i,
|
||||
});
|
||||
expect(disableAllButton).toBeEnabled();
|
||||
await act(async () => {
|
||||
await user.click(disableAllButton);
|
||||
});
|
||||
|
||||
// Verify onUpdateConfig was called with empty enabledTools array
|
||||
await waitFor(() => {
|
||||
expect(onUpdateConfigMock).toHaveBeenCalledWith({ enabledTools: [] });
|
||||
});
|
||||
});
|
||||
|
||||
it('preserves enabledTools when saving config (Codex)', async () => {
|
||||
const { CcwToolsMcpCard } = await import('./CcwToolsMcpCard');
|
||||
const updateCodexMock = vi.mocked(apiMock.updateCcwConfigForCodex);
|
||||
|
||||
Reference in New Issue
Block a user