费用优化
This commit is contained in:
@@ -14,6 +14,9 @@ const api = vi.hoisted(() => ({ customers: vi.fn(), list: vi.fn(), detail: vi.fn
|
||||
const can = vi.hoisted(() => vi.fn((_code: string) => true))
|
||||
vi.mock('@/core/access/accessPreview', () => ({ useAccessPreviewStore: () => ({ can }) }))
|
||||
vi.mock('@/modules/iam', () => ({ listPlatformTenants: api.customers }))
|
||||
vi.mock('@/modules/overseas-business', () => ({ BusinessDocumentFees: {
|
||||
name: 'BusinessDocumentFees', props: ['businessType', 'businessId', 'businessNo', 'customerId'], template: '<div>本单费用操作</div>',
|
||||
} }))
|
||||
vi.mock('../api/cargoDiscards', () => ({ listCargoDiscards: api.list, getCargoDiscard: api.detail, reviewCargoDiscard: api.review, downloadCargoDiscardPhoto: api.photo, getCargoDiscardStatistics: api.statistics }))
|
||||
|
||||
enableAutoUnmount(afterEach)
|
||||
@@ -40,6 +43,14 @@ function errorState(wrapper: Pick<VueWrapper, 'findAllComponents'>, title: strin
|
||||
async function retry(state: VueWrapper) { await state.get('.load-error-state__actions button').trigger('click'); await flushPromises() }
|
||||
|
||||
describe('native cargo discard detail and approval', () => {
|
||||
it('binds fees to the discard application instead of its inventory or outbound order, and unmounts them on close', async () => {
|
||||
const { dialog } = await open()
|
||||
expect(dialog.getComponent({ name: 'BusinessDocumentFees' }).props()).toEqual({
|
||||
businessType: 'DISCARD_ORDER', businessId: '9007199254740993', businessNo: 'CD-001', customerId: '9007199254740994',
|
||||
})
|
||||
await dialog.get('.app-dialog__footer .el-button').trigger('click'); await flushPromises()
|
||||
expect(dialog.findComponent({ name: 'BusinessDocumentFees' }).exists()).toBe(false)
|
||||
})
|
||||
it('preserves all readonly facts, full item values and history through fullscreen', async () => {
|
||||
const { wrapper, dialog } = await open()
|
||||
expect(api.statistics).not.toHaveBeenCalled()
|
||||
@@ -134,6 +145,7 @@ describe('native cargo discard detail and approval', () => {
|
||||
expect(api.photo).toHaveBeenLastCalledWith('CD-002', '9007199254740996', 'CUSTOMER-2')
|
||||
resolve(new Blob(['old'], { type: 'image/png' })); await flushPromises()
|
||||
expect(URL.createObjectURL).toHaveBeenCalledOnce(); expect(dialog.props('title')).toBe('废弃单详情 · CD-002')
|
||||
expect(dialog.getComponent({ name: 'BusinessDocumentFees' }).props()).toMatchObject({ businessNo: 'CD-002', customerId: 'CUSTOMER-2' })
|
||||
})
|
||||
it('ignores a detail response after unmounting before it can start photo downloads', async () => {
|
||||
let resolve!: (value: CargoDiscardDetail) => void
|
||||
|
||||
Reference in New Issue
Block a user