test(client): cover instant image echo branches

This commit is contained in:
creatixchu
2026-08-26 13:49:20 +08:00
parent b22cc3e95b
commit 2dd59b2ca1
3 changed files with 13 additions and 2 deletions
@@ -207,10 +207,16 @@ describe('ImageGallery', () => {
const empty = render(<ImageGallery images={[]} load={load} align="start" labels={labels} />)
expect(empty.container.firstChild).toBeNull()
const view = render(
<ImageGallery images={[{ attachment }, { attachment }]} load={load} align="end" labels={labels} />,
<ImageGallery
images={[{ attachment }, { preview: { url: 'blob:echo', name: 'echo.png' } }, { attachment }]}
load={load}
align="end"
labels={labels}
/>,
)
expect(view.container.querySelector('[data-align="end"]')).not.toBeNull()
await waitFor(() => { expect(view.getAllByAltText('history.png')).toHaveLength(2) })
expect(view.getByAltText('echo.png')).toBeTruthy()
})
it('renders a lone image large and several images as square tiles', () => {
@@ -169,8 +169,10 @@ describe('Chat inject API', () => {
injected.chatScroll.save(null)
expect(injected.chatScroll.read()).toBeNull()
await expect(injected.loadImage(ATTACHMENT)).resolves.toEqual(expect.any(String))
const loaded = await injected.loadImage(ATTACHMENT)
expect(loaded).toEqual(expect.any(String))
expect(b.session.readAttachment).toHaveBeenCalledWith(ATTACHMENT.attachmentId)
expect(injected.loadImage.peek?.(ATTACHMENT)).toBe(loaded)
await b.runtime.dispose()
})
})
@@ -433,6 +433,9 @@ describe('fixture session face', () => {
expect(() => bare.command()).toThrow(/command is not stubbed/)
expect(() => bare.loadOlder()).toThrow(/loadOlder is not stubbed/)
expect(() => bare.rename()).toThrow(/rename is not stubbed/)
const submission = bare.beginSubmission()
expect(submission.requestId).toBe('test-submission-1')
expect(() => { submission.abandon() }).not.toThrow()
await runtime.dispose()
})