From 34b5dc7f289dc9af0a87d3a795e681d2415da3c9 Mon Sep 17 00:00:00 2001
From: shrutip90 <shruti.p90@gmail.com>
Date: Fri, 8 Aug 2025 11:02:27 -0700
Subject: Add FolderTrustDialog that shows on launch and enables folderTrust
 setting (#5815)

---
 packages/cli/src/ui/App.test.tsx | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

(limited to 'packages/cli/src/ui/App.test.tsx')

diff --git a/packages/cli/src/ui/App.test.tsx b/packages/cli/src/ui/App.test.tsx
index 577133ca..82ba4fe1 100644
--- a/packages/cli/src/ui/App.test.tsx
+++ b/packages/cli/src/ui/App.test.tsx
@@ -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?');
+    });
+  });
 });
-- 
cgit v1.2.3

