consolidate.test.ts
TypeScript · 17 рядків
1import assert from 'node:assert/strict';
2import { test } from 'node:test';
3import { PACK, stockOf, useLab } from '../../test/lab.ts';
4
5const lab = useLab();
6
7test('консолідація: контрольна точка = залишок, розбіжностей 0', async () => {
8 const p = await lab.product();
9 await lab.receive(p.id, { lines: [{ packType: PACK.unit, packSize: 1, packCount: 12 }] });
10 await lab.issue(p.id, 5);
11 const r = await lab.api.post('/api/maintenance/consolidate', {});
12 assert.equal(r.mismatches, 0);
13 const s = stockOf(await lab.state(p.id));
14 assert.equal(s.checked_quantity, 7);
15 assert.equal(s.quantity, 7);
16});
17