库存列表: 仅有可用默认开启
页内注释与设计文档(20260913)都写「默认只看有可用」,代码却是 useState(false)。对齐为默认开启,并加契约测试钉住,避免再回退。
This commit is contained in:
@@ -220,7 +220,7 @@ export const InventoryManagement: React.FC = () => {
|
||||
const [searchQuery, setSearchQuery] = useState('');
|
||||
const [expiryFilter, setExpiryFilter] = useState('');
|
||||
/** 默认只看有可用,避免 1900+ 零库存批次淹没有货批次 */
|
||||
const [onlyAvailable, setOnlyAvailable] = useState(false);
|
||||
const [onlyAvailable, setOnlyAvailable] = useState(true);
|
||||
/** 只看有可用量但成本价为空/0 的批次(排查可用货值被低估) */
|
||||
const [withoutCost, setWithoutCost] = useState(false);
|
||||
const [zoneFilter, setZoneFilter] = useState('');
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
/**
|
||||
* 仓库管理(库存列表)「仅有可用」默认开启(2026-10-16 开发者指令)。
|
||||
*
|
||||
* 页内注释与设计文档一直写的是「默认只看有可用」,但代码实际是 `useState(false)`
|
||||
* (`docs/design/20260913-low-stock-stock-managed-only.md` 也如此记载)⇒ 本次对齐为默认开启。
|
||||
*/
|
||||
const page = readFileSync(new URL('./InventoryManagement.tsx', import.meta.url), 'utf8');
|
||||
|
||||
describe('仓库管理:仅有可用默认开启', () => {
|
||||
it('onlyAvailable 初值为 true(避免零库存批次淹没有货批次)', () => {
|
||||
expect(page).toContain('const [onlyAvailable, setOnlyAvailable] = useState(true)');
|
||||
});
|
||||
|
||||
it('首次加载即带上 only_available(随依赖重新拉取)', () => {
|
||||
expect(page).toContain('only_available: onlyAvailable');
|
||||
expect(page).toContain('searchQuery, onlyAvailable, withoutCost, expiryFilter, zoneFilter');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user