feat(fulfillment): 同城运费与路由修复,配送单展示商品用户地址
同城 MANUAL/ZZXFX 按小飞侠价规计费,路由查询回退仓配凭证;HQ 配送单补商品、用户和收货地址。门店核销回跳与小程序核销码一并带上。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,87 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { buildXfxGoodsPayload } from './xfx-goods.util';
|
||||
|
||||
describe('buildXfxGoodsPayload', () => {
|
||||
it('瓶装:品名 + 酒精度,件数等于购买瓶数', () => {
|
||||
expect(
|
||||
buildXfxGoodsPayload({
|
||||
productName: '杜康老窖',
|
||||
productSpec: '单瓶',
|
||||
physicalSpec: '500ml | 53度',
|
||||
quantity: 2,
|
||||
bottlesPerUnit: 1,
|
||||
}),
|
||||
).toEqual({
|
||||
goodsName: '杜康老窖 500ml | 53度 单瓶',
|
||||
goodsNum: 2,
|
||||
});
|
||||
});
|
||||
|
||||
it('箱装:追加包装规格,件数换算为瓶当量', () => {
|
||||
expect(
|
||||
buildXfxGoodsPayload({
|
||||
productName: '杜康老窖',
|
||||
productSpec: '整箱',
|
||||
physicalSpec: '500ml | 53度',
|
||||
quantity: 2,
|
||||
bottlesPerUnit: 6,
|
||||
}),
|
||||
).toEqual({
|
||||
goodsName: '杜康老窖 500ml | 53度 整箱',
|
||||
goodsNum: 12,
|
||||
});
|
||||
});
|
||||
|
||||
it('无度数:回落 SKU 规格;再缺失则只用品名', () => {
|
||||
expect(
|
||||
buildXfxGoodsPayload({
|
||||
productName: '杜康老窖',
|
||||
productSpec: '单瓶',
|
||||
physicalSpec: null,
|
||||
quantity: 3,
|
||||
bottlesPerUnit: 1,
|
||||
}),
|
||||
).toEqual({
|
||||
goodsName: '杜康老窖 单瓶',
|
||||
goodsNum: 3,
|
||||
});
|
||||
|
||||
expect(
|
||||
buildXfxGoodsPayload({
|
||||
productName: '杜康老窖',
|
||||
productSpec: ' ',
|
||||
physicalSpec: undefined,
|
||||
quantity: 1,
|
||||
bottlesPerUnit: 1,
|
||||
}),
|
||||
).toEqual({
|
||||
goodsName: '杜康老窖',
|
||||
goodsNum: 1,
|
||||
});
|
||||
});
|
||||
|
||||
it('规格重复:不把相同文案拼两次', () => {
|
||||
expect(
|
||||
buildXfxGoodsPayload({
|
||||
productName: '杜康老窖',
|
||||
productSpec: '500ml | 53度',
|
||||
physicalSpec: '500ml | 53度',
|
||||
quantity: 1,
|
||||
bottlesPerUnit: 1,
|
||||
}),
|
||||
).toEqual({
|
||||
goodsName: '杜康老窖 500ml | 53度',
|
||||
goodsNum: 1,
|
||||
});
|
||||
|
||||
expect(
|
||||
buildXfxGoodsPayload({
|
||||
productName: '杜康老窖',
|
||||
productSpec: '53度',
|
||||
physicalSpec: '500ml | 53度',
|
||||
quantity: 1,
|
||||
bottlesPerUnit: 1,
|
||||
}).goodsName,
|
||||
).toBe('杜康老窖 500ml | 53度');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user