Zusatzspeicher: Plus sofort anteilig, Minus zum Monatsende, Aufgaben für konsoleH
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
887e1e54a0
commit
379cc26dcd
11 files changed
+1531
-27
No files matched your search
+37
-2
@@ -1,9 +1,20 @@
|
||||
import { test } from 'node:test'
|
||||
import assert from 'node:assert/strict'
|
||||
import { existsSync } from 'node:fs'
|
||||
import path from 'node:path'
|
||||
|
||||
const { config } = await import('../server/config.js')
|
||||
const { getProduct, productKeyForLookupKey, describeItems, priceIdsOfInvoice, creditMinutesForInvoice, termsDocFor, productView } =
|
||||
await import('../server/services/products.js')
|
||||
const {
|
||||
getProduct,
|
||||
productKeyForLookupKey,
|
||||
describeItems,
|
||||
priceIdsOfInvoice,
|
||||
creditMinutesForInvoice,
|
||||
termsDocFor,
|
||||
productView,
|
||||
contractAttachmentFor,
|
||||
regularStorageLine,
|
||||
} = await import('../server/services/products.js')
|
||||
|
||||
const line = (price, amount, proration = false) => ({
|
||||
amount,
|
||||
@@ -161,3 +172,27 @@ test('Produktansicht: Domain-Zeile nennt die Endungen', () => {
|
||||
assert.ok(flat.includes('.de') && flat.includes('.com') && flat.includes('.eu') && flat.includes('.net') && flat.includes('.org'))
|
||||
}
|
||||
})
|
||||
|
||||
// F22 / Task 12: Vertragsunterlagen als Mail-Anhang in der Fassung, der der Kunde zugestimmt hat
|
||||
test('contractAttachmentFor: Datei je Fassung mit absolutem Pfad unter public/', () => {
|
||||
const v3 = contractAttachmentFor('2026-09-25-v3')
|
||||
const v4 = contractAttachmentFor('2026-10-05-v4')
|
||||
assert.equal(v3.filename, 'WEBklar-Wartungs-Abo-Vertragsunterlagen.pdf')
|
||||
assert.equal(v4.filename, 'WEBklar-Abo-Vertragsunterlagen.pdf')
|
||||
assert.ok(path.isAbsolute(v4.path) && v4.path.endsWith(path.join('public', v4.filename)))
|
||||
assert.ok(existsSync(v4.path), v4.path)
|
||||
assert.ok(existsSync(v3.path), v3.path)
|
||||
assert.deepEqual(contractAttachmentFor(null), v3)
|
||||
assert.deepEqual(Object.keys(v4).sort(), ['filename', 'path'])
|
||||
})
|
||||
|
||||
// Task 8: die regulaere Zusatzspeicher-Zeile einer bezahlten Rechnung (Stueckzahl des Monats), nie eine anteilige
|
||||
test('regularStorageLine: reguläre Zusatzspeicher-Zeile, keine anteilige, kein anderes Produkt', () => {
|
||||
const inv = (...lines) => ({ lines: { data: lines } })
|
||||
const storage = { ...line('price_s', 300), quantity: 3 }
|
||||
assert.equal(regularStorageLine(inv(line('price_s', 90, true), line('price_w', 5000), storage), keys), storage)
|
||||
assert.equal(regularStorageLine(inv(line('price_s', 90, true)), keys), null)
|
||||
assert.equal(regularStorageLine(inv(line('price_w', 5000), line('price_h', 1500)), keys), null)
|
||||
assert.equal(regularStorageLine(inv({ amount: 5 }), keys), null)
|
||||
assert.equal(regularStorageLine({}, keys), null)
|
||||
})
|
||||
Reference in new issue
Block a user