优化
This commit is contained in:
@@ -62,6 +62,17 @@ it('shows existing photos without exposing upload for a read-only account', asyn
|
||||
expect(api.uploadLoadingPhoto).not.toHaveBeenCalled(); wrapper.unmount()
|
||||
})
|
||||
|
||||
it('allows choosing another image after the server definitively rejects the file', async () => {
|
||||
vi.mocked(api.uploadLoadingPhoto).mockRejectedValueOnce(new ApiResponseError('图片内容无效', 'A0400'))
|
||||
const wrapper = setup(); await flushPromises(); await upload(wrapper)
|
||||
expect(wrapper.text()).toContain('图片内容无效')
|
||||
expect(wrapper.find('[role="status"]').exists()).toBe(false)
|
||||
expect(api.bindLoadingPhoto).not.toHaveBeenCalled()
|
||||
await upload(wrapper)
|
||||
expect(api.uploadLoadingPhoto).toHaveBeenCalledTimes(2)
|
||||
expect(wrapper.emitted('saved')).toHaveLength(1); wrapper.unmount()
|
||||
})
|
||||
|
||||
it('allows saving photos while loading and keeps the loading stage', async () => {
|
||||
vi.mocked(api.getLoadingDocuments).mockResolvedValue(data({ stage: 'LOADING' }))
|
||||
vi.mocked(api.bindLoadingPhoto).mockResolvedValue(data({ stage: 'LOADING', recordVersion: '1', photos: [photo] }))
|
||||
|
||||
Reference in New Issue
Block a user