This commit is contained in:
seb
2026-09-26 07:34:37 +02:00
parent 607e6cc0ac
commit e491ecfa47
24 changed files with 2162 additions and 1716 deletions

View File

@@ -55,6 +55,7 @@ async function run() {
// Create a delivery manifest with lines
const delivery = await store.delivery.create(googleAuthId, {
supplierId: supplier.id,
externalNumber: 'DEL-1',
date: new Date().toISOString(),
lines: [
@@ -217,9 +218,15 @@ async function run() {
const history = await store.article.getHistoryBySku(googleAuthId, article.sku);
const historyTexts = history.map((h) => h.text);
console.log('Article history texts:', historyTexts);
assert(historyTexts.includes('Initial delivery movement'), 'History should include initial delivery movement');
assert(historyTexts.includes('Damaged item written off'), 'History should include damaged item written off');
assert(historyTexts.includes('Second line goods receipt'), 'History should include second line goods receipt');
assert(
historyTexts.some((t) => t.includes('Initial delivery movement') && t.includes('Lieferant: "Supplier X"') && t.includes('EK brutto: 11.90') && t.includes('Menge: 5')),
'History should include initial delivery movement with supplier, EK brutto, and amount',
);
assert(historyTexts.includes('Damaged item written off'), 'History should include undamaged adjustment memo as is');
assert(
historyTexts.some((t) => t.includes('Second line goods receipt') && t.includes('Lieferant: "Supplier X"') && t.includes('EK brutto: 23.80') && t.includes('Menge: 10')),
'History should include second line goods receipt with details',
);
console.log('✓ All ledger tests passed successfully!');
} finally {