feat(admin): simplify truck payable currency

This commit is contained in:
2026-09-01 10:36:49 +08:00
parent 62a016a2f8
commit 0cf4a93f9c
12 changed files with 74 additions and 30 deletions
@@ -122,4 +122,21 @@ describe('TruckAppointmentForm booking-only behavior', () => {
expect(emitted.containerBookingId).toBeNull()
wrapper.unmount()
})
it('switches the payable currency between RMB and USD and normalizes an illegal legacy value', async () => {
const wrapper = mount(TruckAppointmentForm, {
props: { modelValue: { ...model, payableAmount: '88.00', currency: 'EUR' as never } },
global: { plugins: [ElementPlus] },
})
await flushPromises()
const currencySelect = wrapper.findAllComponents({ name: 'ElSelect' }).find((select) => select.props('placeholder') === '请选择币种')!
expect(currencySelect.props('modelValue')).toBe('RMB')
currencySelect.vm.$emit('update:modelValue', 'USD')
await flushPromises()
const emitted = wrapper.emitted('update:modelValue')?.at(-1)?.[0] as SaveTruckAppointmentRequest
expect(emitted.currency).toBe('USD')
expect(wrapper.text()).toContain('USD')
expect(emitted).not.toHaveProperty('receivableAmount')
wrapper.unmount()
})
})