This commit is contained in:
2026-08-14 14:27:03 +08:00
parent 724848feb6
commit a81af4a664
64 changed files with 961 additions and 176 deletions
@@ -177,6 +177,14 @@ describe('InboundFeePanel', () => {
expect(document.querySelector('[data-testid="adjust-fee-button"]')).not.toBeNull()
})
it('allows adjustment for a calculated fee waiting for split', async () => {
vi.mocked(getLatestInboundFee).mockResolvedValue({ ...snapshot, feeStatus: 'CALCULATED' })
const wrapper = mountPanel()
await flushPromises()
expect(wrapper.find('[data-testid="adjust-fee-button"]').exists()).toBe(true)
})
it('submits a reasoned adjustment and emits the refreshed snapshot', async () => {
const wrapper = mountPanel()
await flushPromises()
@@ -184,12 +192,15 @@ describe('InboundFeePanel', () => {
await flushPromises()
const numbers = [...document.querySelectorAll<HTMLInputElement>('.adjustment-form input')]
numbers[0]!.value = '1200'
numbers[0]!.value = '140'
numbers[0]!.dispatchEvent(new Event('input', { bubbles: true }))
numbers[0]!.dispatchEvent(new Event('change', { bubbles: true }))
numbers[1]!.value = '80'
numbers[1]!.value = '8.2'
numbers[1]!.dispatchEvent(new Event('input', { bubbles: true }))
numbers[1]!.dispatchEvent(new Event('change', { bubbles: true }))
numbers[2]!.value = '80'
numbers[2]!.dispatchEvent(new Event('input', { bubbles: true }))
numbers[2]!.dispatchEvent(new Event('change', { bubbles: true }))
const reason = document.querySelector<HTMLTextAreaElement>('.adjustment-form textarea')!
reason.value = '补充已确认的附加费用'
reason.dispatchEvent(new Event('input', { bubbles: true }))
@@ -203,7 +214,7 @@ describe('InboundFeePanel', () => {
expect(adjustPublishedInboundFee).toHaveBeenCalledWith(
'10001',
'88',
{ subtotalAmount: 1200, additionalAmount: 80, reason: '补充已确认的附加费用' },
{ expectedFeeVersion: 2, chargeableQuantity: 140, unitPrice: 8.2, additionalAmount: 80, reason: '补充已确认的附加费用' },
expect.stringMatching(/^fee-adjust-/),
)
expect(wrapper.emitted('changed')?.[0]?.[0]).toMatchObject({ feeVersion: 3 })
@@ -219,10 +230,12 @@ describe('InboundFeePanel', () => {
await flushPromises()
const numbers = [...document.querySelectorAll<HTMLInputElement>('.adjustment-form input')]
numbers[0]!.value = '1200'
numbers[0]!.value = '140'
numbers[0]!.dispatchEvent(new Event('input', { bubbles: true }))
numbers[1]!.value = '80'
numbers[1]!.value = '8.2'
numbers[1]!.dispatchEvent(new Event('input', { bubbles: true }))
numbers[2]!.value = '80'
numbers[2]!.dispatchEvent(new Event('input', { bubbles: true }))
const reason = document.querySelector<HTMLTextAreaElement>('.adjustment-form textarea')!
reason.value = '并发场景价格修正'
reason.dispatchEvent(new Event('input', { bubbles: true }))