Files
syops/frontend/src/features/chat/components/messages/transferDate.spec.ts
T
hugo abf3d48927 feat(in-transit-transfer): 自动调拨联动收料就绪并分层来源错误
- 调度整合:退役 in_transit_receipt_file_job,收料归档收敛 shipping_receipt_rpa_archive,排程注册表统一
- 自动调拨 Job:调拨前确保各来源当日收料文件就绪(缺失自动触发收料 RPA),严格等量匹配后生成 ERP 调拨单
- worker 手动唤醒:排程工作台支持手动唤醒与 runs 透视,heartbeat 协议同步
- 收料缺失幸存 T2:parse_failed 状态落库(迁移 q4c5)
- 来源错误分层与 stale 时钟换源:改挂 inventory_checked_at 库存查得时刻,展示阈值与执行门禁解耦(迁移 t5a6)
- 新增 wecom_sender 企微通知:每非空 Run 汇总一条,通知失败不影响 ERP 结果
- 同步排程工作台/调拨卡片前端、chat/admin 文案四语言、RPA 脚本与测试全家
2026-09-30 00:20:06 +08:00

25 lines
1.1 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* features/chat/components/messages/transferDate.spec.ts
* 用途:锁定 T+2 成熟口径的截止日计算(与后端 date_policy 同口径,默认 lag=2)。
* 依赖:被测纯函数 transferDate.ts。
* 逻辑:直接注入 UTC 时刻构造上海业务日,断言跨日/跨月边界不漂移。
*/
import { describe, expect, it } from 'vitest';
import { eligibleReceiptDateTo, shanghaiBusinessDate } from './transferDate';
describe('eligibleReceiptDateTo(T+2 口径)', () => {
it('T=2026-09-28 → 截止 2026-09-26(T-2,海外时差)', () => {
// 上海 9-28 13:00 = UTC 05:00。
expect(eligibleReceiptDateTo(new Date('2026-09-28T05:00:00Z'))).toBe('2026-09-26');
});
it('UTC 月末跨界仍按上海业务日回退 2 天', () => {
// 上海 10-01 00:30 = UTC 9-30 16:30 → T=10-01,截止 09-29。
expect(eligibleReceiptDateTo(new Date('2026-09-30T16:30:00Z'))).toBe('2026-09-29');
});
it('shanghaiBusinessDate 返回上海业务日(UTC 17:00 = 上海次日)', () => {
expect(shanghaiBusinessDate(new Date('2026-08-05T17:00:00Z'))).toBe('2026-08-06');
});
});