mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-20 16:57:46 +00:00
Add FolderTrustDialog that shows on launch and enables folderTrust setting (#5815)
This commit is contained in:
@@ -203,6 +203,13 @@ vi.mock('./hooks/useAuthCommand', () => ({
|
||||
})),
|
||||
}));
|
||||
|
||||
vi.mock('./hooks/useFolderTrust', () => ({
|
||||
useFolderTrust: vi.fn(() => ({
|
||||
isFolderTrustDialogOpen: false,
|
||||
handleFolderTrustSelect: vi.fn(),
|
||||
})),
|
||||
}));
|
||||
|
||||
vi.mock('./hooks/useLogger', () => ({
|
||||
useLogger: vi.fn(() => ({
|
||||
getPreviousUserMessages: vi.fn().mockResolvedValue([]),
|
||||
@@ -1091,4 +1098,25 @@ describe('App UI', () => {
|
||||
expect(lastFrame()).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
||||
describe('FolderTrustDialog', () => {
|
||||
it('should display the folder trust dialog when isFolderTrustDialogOpen is true', async () => {
|
||||
const { useFolderTrust } = await import('./hooks/useFolderTrust.js');
|
||||
vi.mocked(useFolderTrust).mockReturnValue({
|
||||
isFolderTrustDialogOpen: true,
|
||||
handleFolderTrustSelect: vi.fn(),
|
||||
});
|
||||
|
||||
const { lastFrame, unmount } = render(
|
||||
<App
|
||||
config={mockConfig as unknown as ServerConfig}
|
||||
settings={mockSettings}
|
||||
version={mockVersion}
|
||||
/>,
|
||||
);
|
||||
currentUnmount = unmount;
|
||||
await Promise.resolve();
|
||||
expect(lastFrame()).toContain('Do you trust this folder?');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user