test(gui): cover native workspace picker branches

This commit is contained in:
ZiyaZhang
2026-07-27 04:37:24 -07:00
parent fef928a7e1
commit a5239b0f64
4 changed files with 109 additions and 4 deletions

View File

@@ -88,7 +88,6 @@ export function WorkspaceCreateFlow({
}
const openLocalFolder = (): void => {
if (pickingFolder) return
onClose()
setModalKind(null)
setModalError(null)
@@ -109,7 +108,6 @@ export function WorkspaceCreateFlow({
}
const handleSelect = (id: string): void => {
if (pickingFolder) return
if (id === OPEN_LOCAL_FOLDER) {
openLocalFolder()
return

View File

@@ -138,6 +138,15 @@ describe('WorkspacePicker', () => {
await act(async () => { resolve(null); await pending })
})
it('reports non-Error native picker failures', async () => {
const b = mount([], vi.fn(), vi.fn(async () => { throw 'picker unavailable' }))
chooseItem('Open local folder…')
await waitFor(() => {
expect(screen.getByRole('alert').textContent).toBe('picker unavailable')
})
expect(b.createWorkspace).not.toHaveBeenCalled()
})
it('closes a creation modal when the user cancels', () => {
mount([])
chooseItem('Create a new workspace')