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
@@ -50,7 +50,10 @@ async function mountView(permissions: string[], initialPath = '/finance/customer
{ path: '/finance/customer-arap/:feeSourceId', name: 'finance-customer-arap-detail', component: FinanceCustomerArapView },
] })
await router.push(initialPath); await router.isReady()
const wrapper = mount(FinanceCustomerArapView, { attachTo: document.body, global: { plugins: [pinia, ElementPlus, router] } })
const wrapper = mount(FinanceCustomerArapView, {
attachTo: document.body,
global: { plugins: [pinia, ElementPlus, router], stubs: { LayoutPreferenceList: true } },
})
await flushPromises()
return Object.assign(wrapper, { router })
}
@@ -164,6 +167,23 @@ describe('FinanceCustomerArapView G2 operations', () => {
expect(wrapper.router.currentRoute.value.name).toBe('finance-customer-arap-detail')
})
it('resolves blank detail customer names from master data and preserves unknown source codes', async () => {
vi.mocked(getFinanceFeeSource).mockResolvedValueOnce({ ...detail, customerName: '', sourceType: 'NEW_SOURCE' })
const wrapper = await mountView(['platform:finance:customer-arap:list'], '/finance/customer-arap/42')
expect(wrapper.text()).toContain('运费 · 客户A')
expect(wrapper.text()).toContain('未识别来源(NEW_SOURCE)')
expect(wrapper.text()).not.toContain('其他来源')
expect(wrapper.text()).not.toContain('42 ·')
})
it.each(['10001', '客户 10001', '客户10001'])('never displays customer id placeholder %s as a customer name', async (customerName) => {
vi.mocked(listPlatformTenants).mockResolvedValueOnce({ records: [], page: 1, size: 200, total: 0, pages: 1 })
vi.mocked(getFinanceFeeSource).mockResolvedValueOnce({ ...detail, customerName })
const wrapper = await mountView(['platform:finance:customer-arap:list'], '/finance/customer-arap/42')
expect(wrapper.text()).toContain('客户名称暂不可用')
expect(wrapper.text()).not.toContain(customerName)
})
it('creates a reconciliation draft from selected eligible receivables', async () => {
const wrapper = await mountView(['platform:finance:customer-arap:list', 'platform:finance:reconciliation:create'])
await loadRows(wrapper)