Vertragsereignisse: Speicher-Aufgaben mit gelesenen Details

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ClaudeandClaude Opus 5.5 committed 2026-09-28 09:25:16 +00:00
1 parent e5cc57cefd
commit 05363d06ad
2 files changed
+29 -3

No files matched your search

+26 -1
View File
@@ -38,7 +38,32 @@ test('Ereignis speichern und lesen (details als JSON)', async () => {
})
const [e] = await listContractEvents('c1')
assert.deepEqual(e.details, { fromUnits: 0, toUnits: 2 })
assert.equal((await listOpenStorageTasks()).length, 1)
// Zweites offenes Speicher-Ereignis mit frueherem dueAt, absichtlich NACH dem ersten angelegt
// (umgekehrte Reihenfolge): listOpenStorageTasks() muss trotzdem nach dueAt aufsteigend sortieren,
// nicht nach der Anlage-Reihenfolge.
await recordContractEvent({
customerId: 'c5',
subscriptionId: 'sub_5',
type: 'speicher',
productKey: 'hosting',
details: { fromUnits: 0, toUnits: 1 },
consent: {
termsVersion: '2026-10-05-v4',
consentAt: '2026-10-02T10:00:00.000Z',
consentIp: '1.2.3.4',
consentUserAgent: 'UA',
},
status: 'offen',
dueAt: '2026-10-03T10:00:00.000Z',
})
const tasks = await listOpenStorageTasks()
assert.equal(tasks.length, 2)
// Wichtig: details kommt geparst zurueck, wie bei listContractEvents (nicht als JSON-String)
assert.equal(tasks[0].details.toUnits, 1)
// Minor: faelligstes (frueheres dueAt) zuerst, unabhaengig von der Anlage-Reihenfolge
assert.deepEqual(tasks.map((t) => t.dueAt), ['2026-10-03T10:00:00.000Z', '2026-10-05T10:00:00.000Z'])
})
test('Widerrufsfristen je Bestellung', () => {