mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-30 04:30:48 +00:00
Merge pull request #2858 from QwenLM/fix/anyof-schema-validation-coercion
fix(core): coerce stringified JSON values for anyOf/oneOf MCP tool schemas
This commit is contained in:
commit
5b550ae7cd
4 changed files with 242 additions and 58 deletions
|
|
@ -2418,36 +2418,6 @@ describe('InputPrompt', () => {
|
|||
unmount();
|
||||
});
|
||||
|
||||
it('should delete entire placeholder on backspace', async () => {
|
||||
const placeholderText = '[Pasted Content 1001 chars]';
|
||||
mockBuffer.text = placeholderText;
|
||||
mockBuffer.lines = [placeholderText];
|
||||
mockBuffer.cursor = [0, placeholderText.length];
|
||||
|
||||
const { stdin, unmount } = renderWithProviders(
|
||||
<InputPrompt {...props} />,
|
||||
);
|
||||
await wait();
|
||||
|
||||
// First set up a placeholder via paste
|
||||
const largeContent = 'x'.repeat(1001);
|
||||
stdin.write(`\x1b[200~${largeContent}\x1b[201~`);
|
||||
await wait();
|
||||
|
||||
// Press backspace to delete the placeholder
|
||||
stdin.write('\x7f'); // backspace character
|
||||
await wait();
|
||||
|
||||
// Verify replaceRangeByOffset was called to delete entire placeholder
|
||||
expect(mockBuffer.replaceRangeByOffset).toHaveBeenCalledWith(
|
||||
0,
|
||||
placeholderText.length,
|
||||
'',
|
||||
);
|
||||
|
||||
unmount();
|
||||
});
|
||||
|
||||
it('should reuse placeholder ID after deletion', async () => {
|
||||
// Set up mocks that actually update buffer state
|
||||
vi.mocked(mockBuffer.insert).mockImplementation((text: string) => {
|
||||
|
|
|
|||
|
|
@ -173,34 +173,6 @@ describe('<AskUserQuestionDialog />', () => {
|
|||
);
|
||||
unmount();
|
||||
});
|
||||
|
||||
it('navigates with number keys', async () => {
|
||||
const onConfirm = vi.fn();
|
||||
const details = createConfirmationDetails();
|
||||
|
||||
const { stdin, unmount } = renderWithProviders(
|
||||
<AskUserQuestionDialog
|
||||
confirmationDetails={details}
|
||||
onConfirm={onConfirm}
|
||||
/>,
|
||||
);
|
||||
await wait();
|
||||
|
||||
// Press '2' to select Blue
|
||||
stdin.write('2');
|
||||
await wait();
|
||||
|
||||
// Press Enter
|
||||
stdin.write('\r');
|
||||
await wait();
|
||||
|
||||
expect(onConfirm).toHaveBeenCalledWith(
|
||||
ToolConfirmationOutcome.ProceedOnce,
|
||||
{ answers: { 0: 'Blue' } },
|
||||
);
|
||||
unmount();
|
||||
});
|
||||
|
||||
it('cancels with Escape', async () => {
|
||||
const onConfirm = vi.fn();
|
||||
const details = createConfirmationDetails();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue