来源仓库:jxc/ai-fresh-delivery 来源提交:f0b1a180e2deb7e4673b9d1c8542619f7bc0f73d 快照树: 09f679334ff38f0ff25e907961c94a8223bcaedd(与来源 HEAD 工作树逐字节一致,3801 个文件) 按约定本仓库不带任何历史提交:来源仓库的历史中含真实凭据 (生产 SSH 私钥 deploy/id_rsa_tencent、server/.env、.env.tencent/.env.production/.env.gitea、 deploy/小程序AppSecret.txt,其中 MP_APPSECRET / S3 AccessKey 经哈希比对与线上同值), 整包推送会把这些凭据永久带入本仓库,故只取「当前版本」的单提交快照。 供应商系统后续开发自本提交开始。
41 lines
1.4 KiB
TypeScript
41 lines
1.4 KiB
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import {
|
|
DELIVERY_DATE_EDIT_MAX_STATUS,
|
|
canEditDeliveryDateByStatus,
|
|
} from '../src/services/orderManageItemsService';
|
|
|
|
/**
|
|
* 列表「配送日」行内编辑的服务端状态闸门(用户 2026-10-08:待处理 + 配送中)。
|
|
* 该纯函数与前端 orderManagementHelpers.canEditDeliveryDateInline 同口径。
|
|
*/
|
|
describe('canEditDeliveryDateByStatus', () => {
|
|
it('待处理组 20/30/40/45 放行', () => {
|
|
for (const s of [20, 30, 40, 45]) expect(canEditDeliveryDateByStatus(s)).toBe(true);
|
|
});
|
|
|
|
it('配送中(60) 放行;上界常量=60', () => {
|
|
expect(DELIVERY_DATE_EDIT_MAX_STATUS).toBe(60);
|
|
expect(canEditDeliveryDateByStatus(60)).toBe(true);
|
|
});
|
|
|
|
it('待配送(50):不放行(已生成配送任务)', () => {
|
|
expect(canEditDeliveryDateByStatus(50)).toBe(false);
|
|
});
|
|
|
|
it('已完成(90) 与历史态(70/80):不放行', () => {
|
|
for (const s of [70, 80, 90]) expect(canEditDeliveryDateByStatus(s)).toBe(false);
|
|
});
|
|
|
|
it('非法/缺失状态:不放行', () => {
|
|
for (const s of [undefined, null, '', 'abc', 0, 10, 61]) {
|
|
expect(canEditDeliveryDateByStatus(s)).toBe(false);
|
|
}
|
|
});
|
|
|
|
it('字符串数字按数字处理(PG 返回 numeric 的场景)', () => {
|
|
expect(canEditDeliveryDateByStatus('60')).toBe(true);
|
|
expect(canEditDeliveryDateByStatus('30')).toBe(true);
|
|
expect(canEditDeliveryDateByStatus('50')).toBe(false);
|
|
});
|
|
});
|