系统判断配送限制

This commit is contained in:
2026-07-26 09:59:38 +08:00
parent 19cb312465
commit da21cd3daa
12 changed files with 176 additions and 10 deletions
+11
View File
@@ -3,6 +3,8 @@ import {
calcBenefitAmount,
calcRedeemSettleAmount,
calcLogisticsFeeByBottles,
calcOrderBoxCount,
shouldHoldAutoCourierDispatch,
validateMinPurchase,
validateRedeemAmount,
allocateBenefitCoupons,
@@ -99,6 +101,15 @@ describe('calcLogisticsFeeByBottles', () => {
});
});
describe('shouldHoldAutoCourierDispatch', () => {
it('holds at 10 full boxes (60 bottles)', () => {
expect(shouldHoldAutoCourierDispatch(59)).toBe(false);
expect(shouldHoldAutoCourierDispatch(60)).toBe(true);
expect(shouldHoldAutoCourierDispatch(66)).toBe(true);
expect(calcOrderBoxCount(60)).toBe(10);
});
});
describe('allocateBenefitCoupons', () => {
const coupons = [
{ id: '1', balance: 300, createdAt: 1 },