cmvr-wms/ruoyi-ui-vue3/tests/unit/purchase-reopen.test.mjs

10 lines
589 B
JavaScript
Raw Normal View History

import test from 'node:test'
import assert from 'node:assert/strict'
import {canReopenPurchase} from '../../src/utils/purchase-sheet-view.js'
test('confirmation can only be reversed before any pending, accepted or received goods',()=>{
const row={id:1,priceLocked:true,purchaseStatus:2}
assert.equal(canReopenPurchase(row),true)
for(const extra of [{historical:true},{priceLocked:false},{purchaseStatus:5},{acceptedQuantity:1},{pendingArrivalQuantity:1},{receivedQuantity:1}])assert.equal(canReopenPurchase({...row,...extra}),false)
assert.equal(canReopenPurchase(undefined),false)
})