Finanzen: Statuszeile, Liquiditaetskopf und Aufgabenliste
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0069a62a09
commit
88a98b858f
10 files changed
+1001
-111
No files matched your search
@@ -15,6 +15,9 @@ const {
|
||||
AGE_GROUP_LABEL,
|
||||
pageOf,
|
||||
canInvoice,
|
||||
nextIntervalDate,
|
||||
ymdBerlin,
|
||||
INTERVAL_LABEL,
|
||||
} = await loadModule('src/lib/financeFormat.js')
|
||||
|
||||
const MINUS = '−'
|
||||
@@ -245,3 +248,53 @@ test('canInvoice: kein Kunde', () => {
|
||||
assert.equal(canInvoice(undefined).ok, false)
|
||||
assert.equal(typeof canInvoice(null).reason, 'string')
|
||||
})
|
||||
|
||||
test('nextIntervalDate: ein Rhythmus nach dem Datum', () => {
|
||||
assert.equal(nextIntervalDate('2026-09-27', 'monat'), '2026-10-27')
|
||||
assert.equal(nextIntervalDate('2026-09-27', 'quartal'), '2026-12-27')
|
||||
assert.equal(nextIntervalDate('2026-09-27', 'jahr'), '2027-09-27')
|
||||
assert.equal(nextIntervalDate('2026-12-15', 'monat'), '2027-01-15')
|
||||
assert.equal(nextIntervalDate('2026-11-15', 'quartal'), '2027-02-15')
|
||||
})
|
||||
|
||||
test('nextIntervalDate: Monatsende wird begrenzt, nicht in den Folgemonat übergelaufen', () => {
|
||||
assert.equal(nextIntervalDate('2026-01-31', 'monat'), '2026-02-28')
|
||||
assert.equal(nextIntervalDate('2024-01-31', 'monat'), '2024-02-29')
|
||||
assert.equal(nextIntervalDate('2026-03-31', 'monat'), '2026-04-30')
|
||||
assert.equal(nextIntervalDate('2026-11-30', 'quartal'), '2027-02-28')
|
||||
assert.equal(nextIntervalDate('2026-08-31', 'quartal'), '2026-11-30')
|
||||
assert.equal(nextIntervalDate('2024-02-29', 'jahr'), '2025-02-28')
|
||||
assert.equal(nextIntervalDate('2023-02-28', 'jahr'), '2024-02-28')
|
||||
assert.equal(nextIntervalDate('1900-01-31', 'monat'), '1900-02-28') // 1900 ist kein Schaltjahr
|
||||
assert.equal(nextIntervalDate('2000-01-31', 'monat'), '2000-02-29')
|
||||
})
|
||||
|
||||
test('nextIntervalDate: ungültige Eingaben ergeben null', () => {
|
||||
assert.equal(nextIntervalDate('2026-02-30', 'monat'), null)
|
||||
assert.equal(nextIntervalDate('2026-13-01', 'monat'), null)
|
||||
assert.equal(nextIntervalDate('2026-00-10', 'monat'), null)
|
||||
assert.equal(nextIntervalDate('2026-04-31', 'monat'), null)
|
||||
assert.equal(nextIntervalDate('27.09.2026', 'monat'), null)
|
||||
assert.equal(nextIntervalDate('', 'monat'), null)
|
||||
assert.equal(nextIntervalDate(null, 'monat'), null)
|
||||
assert.equal(nextIntervalDate(undefined, 'monat'), null)
|
||||
assert.equal(nextIntervalDate('2026-09-27', 'woche'), null)
|
||||
assert.equal(nextIntervalDate('2026-09-27', undefined), null)
|
||||
assert.equal(nextIntervalDate('2026-09-27', 'constructor'), null)
|
||||
})
|
||||
|
||||
test('INTERVAL_LABEL: deutsche Rhythmus-Wörter wie im Portal', () => {
|
||||
assert.deepEqual(INTERVAL_LABEL, { monat: 'monatlich', quartal: 'vierteljährlich', jahr: 'jährlich' })
|
||||
})
|
||||
|
||||
test('ymdBerlin: Berliner Kalendertag eines Zeitpunkts', () => {
|
||||
assert.equal(ymdBerlin('2026-10-01T10:55:21.691Z'), '2026-10-01')
|
||||
assert.equal(ymdBerlin('2026-07-01T23:30:00.000Z'), '2026-07-02') // Sommerzeit: schon der nächste Tag
|
||||
assert.equal(ymdBerlin('2099-03-29T00:00:00.000Z'), '2099-03-29')
|
||||
assert.equal(ymdBerlin(new Date('2026-12-31T23:30:00Z')), '2027-01-01')
|
||||
assert.equal(ymdBerlin(Date.UTC(2026, 9, 1, 12)), '2026-10-01')
|
||||
assert.equal(ymdBerlin(''), null)
|
||||
assert.equal(ymdBerlin('kein Datum'), null)
|
||||
assert.equal(ymdBerlin(null), null)
|
||||
assert.equal(ymdBerlin(NaN), null)
|
||||
})
|
||||
Reference in new issue
Block a user