fix(coding): remediate ML-07 plugin authority
This commit is contained in:
1 parent
9407c67df2
commit
cf13aa7eba
29 files changed
+1008
-214
No files matched your search
@@ -0,0 +1,59 @@
|
||||
import { fireEvent, render, screen, waitFor } from '@testing-library/react';
|
||||
import { describe, expect, it, vi } from 'vitest';
|
||||
import { AgentCreationDialog } from '@/components/coding/AgentCreationDialog';
|
||||
import type { CodingProjectAgent } from '@/types/coding-project';
|
||||
|
||||
const agent: CodingProjectAgent = {
|
||||
id: 'builder',
|
||||
avatarId: 'avatar-01',
|
||||
roleName: '实现者',
|
||||
name: 'Builder',
|
||||
builtIn: false,
|
||||
enabled: true,
|
||||
model: { accountId: 'account-a', modelId: 'model-a', thinkingLevel: 'medium' },
|
||||
modelResolution: 'resolved',
|
||||
skillIds: ['data-service'],
|
||||
responsibility: {
|
||||
mission: 'Implement changes', owns: [], boundaries: [], collaborators: [], principles: [],
|
||||
},
|
||||
prompt: '',
|
||||
archivedAt: null,
|
||||
pinned: false,
|
||||
createdAt: '2026-08-27T00:00:00Z',
|
||||
updatedAt: '2026-08-27T00:00:00Z',
|
||||
};
|
||||
|
||||
describe('AgentCreationDialog plugin Skill availability', () => {
|
||||
it('shows a retained disabled assignment as unavailable and persists it unchanged', async () => {
|
||||
const onUpdate = vi.fn(async () => undefined);
|
||||
render(<AgentCreationDialog
|
||||
open
|
||||
onOpenChange={vi.fn()}
|
||||
agent={agent}
|
||||
modelOptions={[{
|
||||
key: JSON.stringify(['account-a', 'model-a']),
|
||||
accountId: 'account-a',
|
||||
modelId: 'model-a',
|
||||
label: 'Account A / Model A',
|
||||
}]}
|
||||
skills={[{
|
||||
id: 'data-service',
|
||||
name: 'Data Service',
|
||||
description: 'Project data tools',
|
||||
available: false,
|
||||
effective: false,
|
||||
}]}
|
||||
onUpdate={onUpdate}
|
||||
/>);
|
||||
|
||||
const checkbox = screen.getByRole('checkbox', { name: '绑定技能:Data Service' });
|
||||
expect(checkbox).toBeChecked();
|
||||
expect(checkbox).toBeDisabled();
|
||||
expect(screen.getByText('插件未启用;现有分配会保留,但当前不可用。')).toBeVisible();
|
||||
|
||||
fireEvent.click(screen.getByRole('button', { name: '保存伙伴' }));
|
||||
await waitFor(() => expect(onUpdate).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ skillIds: ['data-service'] }),
|
||||
));
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user