summaryrefslogtreecommitdiff
path: root/packages/cli/src/ui/components/FolderTrustDialog.test.tsx
diff options
context:
space:
mode:
authorJacob Richman <[email protected]>2025-08-12 14:05:49 -0700
committerGitHub <[email protected]>2025-08-12 21:05:49 +0000
commitd219f9013206aad5a1361e436ad4a45114e9cd49 (patch)
tree58216dc659e809bc896b03de21a9a1c713126d6b /packages/cli/src/ui/components/FolderTrustDialog.test.tsx
parent74fd0841d0d7148127e586fce4c550a01ff40e90 (diff)
Switch from useInput to useKeypress. (#6056)
Diffstat (limited to 'packages/cli/src/ui/components/FolderTrustDialog.test.tsx')
-rw-r--r--packages/cli/src/ui/components/FolderTrustDialog.test.tsx9
1 files changed, 6 insertions, 3 deletions
diff --git a/packages/cli/src/ui/components/FolderTrustDialog.test.tsx b/packages/cli/src/ui/components/FolderTrustDialog.test.tsx
index 01394d0f..d1be0b61 100644
--- a/packages/cli/src/ui/components/FolderTrustDialog.test.tsx
+++ b/packages/cli/src/ui/components/FolderTrustDialog.test.tsx
@@ -5,6 +5,7 @@
*/
import { render } from 'ink-testing-library';
+import { waitFor } from '@testing-library/react';
import { vi } from 'vitest';
import { FolderTrustDialog, FolderTrustChoice } from './FolderTrustDialog.js';
@@ -18,12 +19,14 @@ describe('FolderTrustDialog', () => {
);
});
- it('should call onSelect with DO_NOT_TRUST when escape is pressed', () => {
+ it('should call onSelect with DO_NOT_TRUST when escape is pressed', async () => {
const onSelect = vi.fn();
const { stdin } = render(<FolderTrustDialog onSelect={onSelect} />);
- stdin.write('\u001B'); // Simulate escape key
+ stdin.write('\x1b');
- expect(onSelect).toHaveBeenCalledWith(FolderTrustChoice.DO_NOT_TRUST);
+ await waitFor(() => {
+ expect(onSelect).toHaveBeenCalledWith(FolderTrustChoice.DO_NOT_TRUST);
+ });
});
});