Add FolderTrustDialog that shows on launch and enables folderTrust setting (#5815)

This commit is contained in:
shrutip90
2025-08-08 11:02:27 -07:00
committed by GitHub
parent 3af4913ef3
commit 34b5dc7f28
7 changed files with 244 additions and 1 deletions

View File

@@ -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?');
});
});
});