mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-21 09:17:53 +00:00
feat: Show untrusted status in the Footer (#6210)
Co-authored-by: Jacob Richman <jacob314@gmail.com>
This commit is contained in:
@@ -163,6 +163,7 @@ vi.mock('@google/gemini-cli-core', async (importOriginal) => {
|
||||
getCurrentIde: vi.fn(() => 'vscode'),
|
||||
getDetectedIdeDisplayName: vi.fn(() => 'VSCode'),
|
||||
})),
|
||||
isTrustedFolder: vi.fn(() => true),
|
||||
};
|
||||
});
|
||||
|
||||
@@ -1118,5 +1119,45 @@ describe('App UI', () => {
|
||||
await Promise.resolve();
|
||||
expect(lastFrame()).toContain('Do you trust this folder?');
|
||||
});
|
||||
|
||||
it('should display the folder trust dialog when the feature is enabled but the folder is not trusted', async () => {
|
||||
const { useFolderTrust } = await import('./hooks/useFolderTrust.js');
|
||||
vi.mocked(useFolderTrust).mockReturnValue({
|
||||
isFolderTrustDialogOpen: true,
|
||||
handleFolderTrustSelect: vi.fn(),
|
||||
});
|
||||
mockConfig.isTrustedFolder.mockReturnValue(false);
|
||||
|
||||
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?');
|
||||
});
|
||||
|
||||
it('should not display the folder trust dialog when the feature is disabled', async () => {
|
||||
const { useFolderTrust } = await import('./hooks/useFolderTrust.js');
|
||||
vi.mocked(useFolderTrust).mockReturnValue({
|
||||
isFolderTrustDialogOpen: false,
|
||||
handleFolderTrustSelect: vi.fn(),
|
||||
});
|
||||
mockConfig.isTrustedFolder.mockReturnValue(false);
|
||||
|
||||
const { lastFrame, unmount } = render(
|
||||
<App
|
||||
config={mockConfig as unknown as ServerConfig}
|
||||
settings={mockSettings}
|
||||
version={mockVersion}
|
||||
/>,
|
||||
);
|
||||
currentUnmount = unmount;
|
||||
await Promise.resolve();
|
||||
expect(lastFrame()).not.toContain('Do you trust this folder?');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user