优化
This commit is contained in:
@@ -157,6 +157,21 @@ describe('formal settlement native dialogs', () => {
|
||||
await click(dialog, '确定')
|
||||
expect(api.createReceivableSettlement).toHaveBeenCalledWith({ reconciliationStatementId: statement.id, currency: 'CNY' })
|
||||
})
|
||||
it.each([true, false])('warns before creating receivables from an unconfirmed statement (continue=%s)', async (proceed) => {
|
||||
vi.mocked(api.listFinanceStatements).mockResolvedValue([{ ...statement, customerConfirmationStatus: 'PENDING_CONFIRMATION' }])
|
||||
const confirmation = vi.spyOn(ElMessageBox, 'confirm')
|
||||
if (proceed) confirmation.mockResolvedValue('confirm')
|
||||
else confirmation.mockRejectedValue('cancel')
|
||||
const { dialog } = await openCreate('receivable')
|
||||
const selects = dialog.findAllComponents({ name: 'ElSelect' })
|
||||
selects[0]!.vm.$emit('update:modelValue', String(customer.id))
|
||||
await flushPromises()
|
||||
selects[1]!.vm.$emit('update:modelValue', statement.id)
|
||||
await click(dialog, '确定')
|
||||
expect(confirmation).toHaveBeenCalledWith('客户暂未确认!', '生成应收结算单', expect.objectContaining({ type: 'warning' }))
|
||||
expect(api.createReceivableSettlement).toHaveBeenCalledTimes(proceed ? 1 : 0)
|
||||
if (!proceed) expect(dialog.props('modelValue')).toBe(true)
|
||||
})
|
||||
it('keeps active suppliers and excludes directly paid or locked payable sources', async () => {
|
||||
const { dialog } = await openCreate('payable')
|
||||
const selects = dialog.findAllComponents({ name: 'ElSelect' })
|
||||
|
||||
Reference in New Issue
Block a user