This commit is contained in:
seb
2026-10-20 05:33:11 +02:00
parent 5cb38874ca
commit bcefd81af7
23 changed files with 514 additions and 150 deletions

View File

@@ -281,8 +281,8 @@ async function run() {
assert.equal(sum2.is_shipped, 0);
console.log('PASS: 9b. Shipped SOME items with omitted amount; ordersummary updated with shipped_quantity=10, is_shipped=0');
// 9c. Ship ALL remaining items by omitting lines entirely ({})
const shAll = await store.order.createShipment(googleAuthId, order2.id, {});
// 9c. Ship remaining items with explicit lines
const shAll = await store.order.createShipment(googleAuthId, order2.id, { lines: [{ sku: 'ITEM-B', amount: 5 }] });
assert.equal(shAll.number, 'AU-1002-L-3');
assert.equal(shAll.lines.length, 1);
assert.equal(shAll.lines[0].sku, 'ITEM-B');
@@ -292,16 +292,16 @@ async function run() {
sum2 = provider.db.prepare('SELECT * FROM ordersummary WHERE manifest_id = ?').get(order2.id);
assert.equal(sum2.shipped_quantity, 15);
assert.equal(sum2.is_shipped, 1);
console.log('PASS: 9c. Shipped ALL remaining items with omitted lines; ordersummary updated with shipped_quantity=15, is_shipped=1');
console.log('PASS: 9c. Shipped remaining items with explicit lines; ordersummary updated with shipped_quantity=15, is_shipped=1');
// 9d. Calling createShipment when all items already shipped throws 'All items already shipped'
// 9d. Calling createShipment without lines is rejected with "Invalid lines"
await assert.rejects(
async () => {
await store.order.createShipment(googleAuthId, order2.id);
},
{ message: 'All items already shipped' }
{ message: 'Invalid lines' }
);
console.log('PASS: 9d. Re-shipping fully shipped order rejected with "All items already shipped"');
console.log('PASS: 9d. Creating shipment without lines rejected with "Invalid lines"');
// 10. Verify peek next number works for entity and other types without error
const nextEntity = await store.entity.peekNextNumber(googleAuthId);