Files
SupplierSystem/src/utils/pickingAssembly.test.ts
T
Ubuntu 5fa2bbfd55
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s
fix(audit-20261019): T1-T9 审计修复、存储归属与审计日志列宽
- T1 资金/库存/报价/自采 P1(BIZ-1/2/3/4/10/13/14)
- T2 主系统反向事件墓碑/改派/孤儿处理(BIZ-6/8/9)
- T3 选分公司 ticket、trust proxy、角色权限收口(SEC-2/3/4)
- T4 缺列/RLS/tenant 名单/FK/迁移执行器(DATA-1..8)
- T5 401 登出/分页/映射口径/blob/ZIP 中文名(FE-1..4/BIZ-15)
- T6 测试脚本目标守卫/config fail-fast/容器配置(OPS-2..8)
- T7 前后端测试与 lint 门禁清零
- T8 应付卡片按关联订单日(口径 A)
- T9 存储对象全链路归属校验、敏感列禁写、审计 target_id 超长修复
2026-10-19 16:16:51 +08:00

47 lines
2.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.
import { describe, expect, it } from 'vitest';
/**
* 小程序分拣列表「显示哪些行」的口径(2026-10-16 开发者指令):
* 未完成单只展示**待分拣**行(已确认的即时移出视野);已完成单仍为「待补录,全确认回退全部」。
* 设计见 docs/design/20261016-小程序分拣已确认行即时隐藏.md。
*/
import { createRequire } from 'node:module';
const requireForMiniprogram = createRequire(import.meta.url);
const { visibleItemsForStatus } = requireForMiniprogram('../../miniprogram/utils/pickingAssembly');
/** 已确认:有实拣量 + review_status ≥ 20(与 isItemPicked 同口径) */
const picked = (n = 1) => ({ picked_qty: n, review_status: 20, settlement_qty: n });
/** 待分拣:无实拣量 */
const pending = () => ({ picked_qty: 0, review_status: 10, settlement_qty: 0 });
/** 有量但未确认(补录用;isItemPending 仍为 true) */
const staged = () => ({ picked_qty: 3, review_status: 10, settlement_qty: 3 });
describe('visibleItemsForStatus', () => {
it('未完成单(< 30):只展示待分拣行 —— 已确认的即时移出视野', () => {
const out = visibleItemsForStatus([pending(), picked(), pending()], 20);
expect(out.length).toBe(2);
expect(out.every((i: { review_status: number }) => i.review_status === 10)).toBe(true);
});
it('未完成单全部确认 ⇒ 空列表(不回退展示全部)', () => {
expect(visibleItemsForStatus([picked(), picked(2)], 10)).toEqual([]);
});
it('已完成单(≥ 30):只留待补录(含"有量未确认")', () => {
const out = visibleItemsForStatus([pending(), staged(), picked()], 30);
expect(out.length).toBe(2);
expect(out).toContainEqual(staged());
});
it('已完成单全部确认 ⇒ 回退展示全部(供复核)', () => {
const all = [picked(), picked(2)];
expect(visibleItemsForStatus(all, 30)).toEqual(all);
});
it('已出库(≥ 40)⇒ 展示全部', () => {
const all = [pending(), picked()];
expect(visibleItemsForStatus(all, 40)).toEqual(all);
expect(visibleItemsForStatus(all, 50)).toEqual(all);
});
});