优化
This commit is contained in:
@@ -5,6 +5,7 @@ import { DOMWrapper, enableAutoUnmount, flushPromises, mount, type VueWrapper }
|
||||
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
||||
import { useAccessPreviewStore } from '@/core/access/accessPreview'
|
||||
import { useAuthStore } from '@/core/auth/auth'
|
||||
import { ApiResponseError } from '@/shared/api/http'
|
||||
import {
|
||||
confirmWeightResult,
|
||||
correctWeightResult,
|
||||
@@ -482,7 +483,7 @@ describe('WeightOcrPanel confirmation behavior', () => {
|
||||
})
|
||||
|
||||
it('keeps the edited draft available when confirmation fails', async () => {
|
||||
vi.mocked(confirmWeightResult).mockRejectedValueOnce(new Error('version conflict'))
|
||||
vi.mocked(confirmWeightResult).mockRejectedValueOnce(new ApiResponseError('数据版本已变化,请刷新后重试', 'A0409', 409))
|
||||
const wrapper = mountPanel()
|
||||
await flushPromises()
|
||||
await openWeightDialog(wrapper)
|
||||
@@ -493,7 +494,7 @@ describe('WeightOcrPanel confirmation behavior', () => {
|
||||
await flushPromises()
|
||||
|
||||
expect((input.element as HTMLInputElement).value).toBe('286.125')
|
||||
expect(wrapper.text()).toContain('version conflict')
|
||||
expect(wrapper.text()).toContain('数据版本已变化,请刷新后重试')
|
||||
expect(confirmWeightResult).toHaveBeenCalledTimes(1)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user