Files
zkxw/web-admin/src/utils/protocol-payment-payload.test.ts
T
2026-10-14 12:32:03 +08:00

65 lines
2.0 KiB
TypeScript

import { describe, it } from 'node:test'
import assert from 'node:assert/strict'
import * as installment from './protocol-payment-installment'
describe('buildProtocolPaymentDetailPayload', () => {
it('keeps normal draft fields and strips finance/refund state fields', () => {
const buildPayload = (installment as any).buildProtocolPaymentDetailPayload
assert.equal(typeof buildPayload, 'function')
const payload = buildPayload({
id: 'detail-1',
transferType: 'bank',
dueAmount: 1200,
transferAmount: 1000,
transferTime: '2026-10-14 10:00:00',
installmentNo: '2',
installmentDueDate: '20261114',
remark: '草稿备注',
attachments: [
{
id: 'attachment-1',
fileName: 'receipt.pdf',
fileUrl: '/receipt.pdf',
fileSize: 10,
fileSizeDisplay: '10 B',
fileType: 'application/pdf',
localOnly: true
}
],
payStatus: 'yjf',
financeRemark: '不应提交',
financeConfirmAttachments: 'finance.pdf',
financeConfirmAttachmentFiles: [{ fileUrl: '/finance.pdf' }],
refundAmount: 100,
refundRemark: '不应提交',
refundAttachments: 'refund.pdf',
refundAttachmentFiles: [{ fileUrl: '/refund.pdf' }],
refundFinanceRemark: '不应提交',
refundFinanceConfirmAttachments: 'refund-confirm.pdf',
refundFinanceConfirmAttachmentFiles: [{ fileUrl: '/refund-confirm.pdf' }]
})
assert.deepEqual(payload, {
id: 'detail-1',
transferType: 'bank',
dueAmount: 1200,
transferAmount: 1000,
transferTime: '2026-10-14 10:00:00',
installmentNo: 2,
installmentDueDate: '20261114',
remark: '草稿备注',
attachments: [
{
id: 'attachment-1',
fileName: 'receipt.pdf',
fileUrl: '/receipt.pdf',
fileSize: 10,
fileSizeDisplay: '10 B',
fileType: 'application/pdf'
}
]
})
})
})