mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-05 12:24:30 +01:00
feat(ui): dock repo and session tools in a desktop side panel
Add a docked desktop tool panel with an icon rail, driven by the shared panel URL param, and keep the mobile dialogs and drawers. Extract dialog bodies into reusable content components, rename the walkthrough dialog to a sheet, and make walkthrough generation asynchronous with client polling.
This commit is contained in:
1 parent
bdbcc60716
commit
485ab940aa
49 files changed
+2631
-1753
No files matched your search
@@ -0,0 +1,32 @@
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
import { FetchError, fetchWrapper } from './fetchWrapper'
|
||||
|
||||
function respondWith(body: string, status: number) {
|
||||
vi.stubGlobal('fetch', vi.fn(async () => new Response(body, { status })))
|
||||
}
|
||||
|
||||
describe('fetchWrapper error bodies', () => {
|
||||
afterEach(() => {
|
||||
vi.unstubAllGlobals()
|
||||
})
|
||||
|
||||
it('uses the JSON error message', async () => {
|
||||
respondWith(JSON.stringify({ error: 'Session not found', code: 'NOT_FOUND' }), 404)
|
||||
|
||||
await expect(fetchWrapper('/api/x')).rejects.toMatchObject({ message: 'Session not found', statusCode: 404, code: 'NOT_FOUND' })
|
||||
})
|
||||
|
||||
it('keeps a plain-text error body', async () => {
|
||||
respondWith('upstream unavailable', 502)
|
||||
|
||||
await expect(fetchWrapper('/api/x')).rejects.toMatchObject({ message: 'upstream unavailable' })
|
||||
})
|
||||
|
||||
it('replaces an HTML error page with a status message', async () => {
|
||||
respondWith('<!DOCTYPE html><html><body>A timeout occurred</body></html>', 524)
|
||||
|
||||
const error = await fetchWrapper('/api/x').catch((caught: unknown) => caught)
|
||||
expect(error).toBeInstanceOf(FetchError)
|
||||
expect((error as FetchError).message).toBe('Request failed with status 524')
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user