Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

test(desktop): r7-l15 cover unavailable image controls

Josuéc0ac1c9e30fd
diff --git a/desktop-app/ui/src/components/GfsImagePreview/GfsImagePreview.test.tsx b/desktop-app/ui/src/components/GfsImagePreview/GfsImagePreview.test.tsx
index 3774392f3..9384d8f83 100644
--- a/desktop-app/ui/src/components/GfsImagePreview/GfsImagePreview.test.tsx
+++ b/desktop-app/ui/src/components/GfsImagePreview/GfsImagePreview.test.tsx
@@ -92,4 +92,26 @@ describe('GfsImagePreview layout', () => {
expect((modal as HTMLElement).style.right).toBe('0px')
})
})
+
+ it('keeps the unavailable image dialog named and closable', async () => {
+ const downloadPreview = vi.fn(async () => {
+ throw new Error('404 File unavailable')
+ })
+ window.clerum.gfs.downloadPreview = downloadPreview
+ render(
+ <GfsImagePreview
+ byteLength={3}
+ fileName="diagram.png"
+ gfsUri="gfs://main/image-1"
+ mimeType="image/png"
+ onClose={vi.fn()}
+ />
+ )
+
+ expect(await screen.findByText(/File unavailable/)).toBeTruthy()
+ const dialog = screen.getByRole('dialog', { name: 'diagram.png' })
+ const title = screen.getByRole('heading', { name: 'diagram.png' })
+ expect(dialog.getAttribute('aria-labelledby')).toBe(title.id)
+ expect(screen.getByRole('button', { name: 'Close image preview' })).toBeTruthy()
+ })
})