优化
This commit is contained in:
@@ -1,18 +1,11 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { requireReviewedProcurementFees } from './procurementOutboundFees'
|
||||
import { hasProcurementFeeDetails } from './procurementOutboundFees'
|
||||
|
||||
describe('procurement outbound fee gate', () => {
|
||||
const approved = { direction: 'RECEIVABLE' as const, sourceStatus: 'ACTIVE', reviewStatus: 'APPROVED' }
|
||||
it('requires a current receivable, excluding voided fees and payables', () => {
|
||||
for (const rows of [[], [{ ...approved, sourceStatus: 'VOIDED' }], [{ ...approved, direction: 'PAYABLE' as const }]]) {
|
||||
expect(() => requireReviewedProcurementFees(rows)).toThrow('请先添加费用明细')
|
||||
}
|
||||
})
|
||||
it('requires every current fee to be active and approved', () => {
|
||||
for (const reviewStatus of ['PENDING', 'REJECTED']) {
|
||||
expect(() => requireReviewedProcurementFees([approved, { ...approved, reviewStatus }])).toThrow('尚未全部审核通过')
|
||||
}
|
||||
expect(() => requireReviewedProcurementFees([approved, { ...approved, sourceStatus: 'VOIDING' }])).toThrow('尚未全部审核通过')
|
||||
expect(() => requireReviewedProcurementFees([approved, { ...approved, sourceStatus: 'VOIDED', reviewStatus: 'REJECTED' }])).not.toThrow()
|
||||
describe('procurement outbound fee notice', () => {
|
||||
it('only reports when there is no current receivable fee detail', () => {
|
||||
expect(hasProcurementFeeDetails([])).toBe(false)
|
||||
expect(hasProcurementFeeDetails([{ direction: 'RECEIVABLE', sourceStatus: 'VOIDED' }])).toBe(false)
|
||||
expect(hasProcurementFeeDetails([{ direction: 'PAYABLE', sourceStatus: 'ACTIVE' }])).toBe(false)
|
||||
expect(hasProcurementFeeDetails([{ direction: 'RECEIVABLE', sourceStatus: 'ACTIVE' }])).toBe(true)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user