diff options
| author | Tommaso Sciortino <[email protected]> | 2025-07-07 16:27:24 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-07-07 23:27:24 +0000 |
| commit | 4e84989d8f6330027327f4fc214055c1cd7bf45b (patch) | |
| tree | dfb4db65a7ba54683ee36c2a8211caecc17055f4 /packages/cli/src/ui/components/AuthDialog.test.tsx | |
| parent | 426b6905dad7c7b437b665b4750f1307e278d7ce (diff) | |
Fix double "esc" bug in Auth dialog (#3493)
Diffstat (limited to 'packages/cli/src/ui/components/AuthDialog.test.tsx')
| -rw-r--r-- | packages/cli/src/ui/components/AuthDialog.test.tsx | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/packages/cli/src/ui/components/AuthDialog.test.tsx b/packages/cli/src/ui/components/AuthDialog.test.tsx index 15c6d68a..8f07e2a5 100644 --- a/packages/cli/src/ui/components/AuthDialog.test.tsx +++ b/packages/cli/src/ui/components/AuthDialog.test.tsx @@ -45,9 +45,7 @@ describe('AuthDialog', () => { const onSelect = vi.fn(); const settings: LoadedSettings = new LoadedSettings( { - settings: { - selectedAuthType: undefined, - }, + settings: {}, path: '', }, { @@ -74,6 +72,40 @@ describe('AuthDialog', () => { unmount(); }); + it('should not exit if there is already an error message', async () => { + const onSelect = vi.fn(); + const settings: LoadedSettings = new LoadedSettings( + { + settings: {}, + path: '', + }, + { + settings: {}, + path: '', + }, + [], + ); + + const { lastFrame, stdin, unmount } = render( + <AuthDialog + onSelect={onSelect} + settings={settings} + initialErrorMessage="Initial error" + />, + ); + await wait(); + + expect(lastFrame()).toContain('Initial error'); + + // Simulate pressing escape key + stdin.write('\u001b'); // ESC key + await wait(); + + // Should not call onSelect + expect(onSelect).not.toHaveBeenCalled(); + unmount(); + }); + it('should allow exiting when auth method is already selected', async () => { const onSelect = vi.fn(); const settings: LoadedSettings = new LoadedSettings( |
