This commit is contained in:
2026-08-17 19:13:25 +08:00
parent 28f2cd4cc5
commit d618683467
22 changed files with 263 additions and 50 deletions
@@ -75,7 +75,7 @@ describe('InboundFeePanel', () => {
expect(getLatestInboundFee).toHaveBeenCalledWith('10001', '88')
expect(document.body.textContent).not.toContain('租户')
expect(document.body.textContent).toContain('对客费用总额 · CNY')
expect(document.body.textContent).toContain('头程自动费用 · CNY')
expect(document.body.textContent).toContain('¥1,235.60')
expect(document.body.textContent).toContain('基础运费小计 ¥1,135.60')
expect(document.body.textContent).toContain('附加费 ¥100.00')
@@ -130,8 +130,10 @@ describe('InboundFeePanel', () => {
const content = wrapper.find('.fee-content').text()
expect(wrapper.findAll('.fee-summary > div > span').map((node) => node.text())).toEqual([
'对客费用总额 · CNY',
'头程自动费用 · CNY',
'最终计费量',
'单价',
'附加费',
'快照版本',
])
expect(wrapper.findAll('.calculation-flow > div > span').map((node) => node.text())).toEqual([
@@ -169,12 +171,13 @@ describe('InboundFeePanel', () => {
expect(document.querySelector('[role="alert"]')).toBeNull()
})
it('shows adjustment only for authorized published inbound fees', async () => {
it('shows adjustment only for authorized calculated inbound fees', async () => {
mountPanel(['firstleg:fba-pricing:view'])
await flushPromises()
expect(document.querySelector('[data-testid="adjust-fee-button"]')).toBeNull()
document.body.innerHTML = ''
vi.mocked(getLatestInboundFee).mockResolvedValue({ ...snapshot, feeStatus: 'CALCULATED' })
mountPanel()
await flushPromises()
expect(document.querySelector('[data-testid="adjust-fee-button"]')).not.toBeNull()
@@ -189,6 +192,7 @@ describe('InboundFeePanel', () => {
})
it('submits a reasoned adjustment and emits the refreshed snapshot', async () => {
vi.mocked(getLatestInboundFee).mockResolvedValue({ ...snapshot, feeStatus: 'CALCULATED' })
const wrapper = mountPanel()
await flushPromises()
;(document.querySelector('[data-testid="adjust-fee-button"]') as HTMLButtonElement).click()
@@ -233,6 +237,7 @@ describe('InboundFeePanel', () => {
})
it('refreshes the latest snapshot after a conflict while retaining the dialog', async () => {
vi.mocked(getLatestInboundFee).mockResolvedValue({ ...snapshot, feeStatus: 'CALCULATED' })
vi.mocked(adjustPublishedInboundFee).mockRejectedValue(
new ApiResponseError('费用已被其他操作员修改,请刷新后重试', 'A0409', 409),
)