Funktionen: Bestellschutz, serialisiertes markPaid, idx_session

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
knsoandClaude Opus 5.5 committed 2026-09-30 16:29:12 +00:00
1 parent 4b1df8fbfa
commit 770cbe32b7
3 files changed
+53 -19

No files matched your search

+21
View File
@@ -110,3 +110,24 @@ test('lange_projekt_id_bekommt_gueltige_dokument_id', async () => {
const doc = await sf.adminActivate('c1', 'p_' + 'x'.repeat(40), 'news', {})
assert.ok(doc.$id.length <= 36)
})
test('bestellen_bei_aktiver_funktion_409', async () => {
const doc = await sf.adminActivate('c1', 'p1', 'news', {}).catch(() => null)
const active = doc || (await sf.getFeatureDoc('c1', 'p1', 'news'))
assert.equal(active.state, 'active')
await assert.rejects(
() => sf.markOrdered({ customerId: 'c1', projectId: 'p1', key: 'news', sessionId: 'cs_x', consent }),
{ status: 409 }
)
assert.equal((await sf.getFeatureDoc('c1', 'p1', 'news')).state, 'active')
})
test('parallele_webhooks_ein_ticket', async () => {
aw.seed('websiteProjects', { $id: 'p4', customerId: 'c1', projectName: 'Parallel' })
await sf.markOrdered({ customerId: 'c1', projectId: 'p4', key: 'news', sessionId: 'cs_par', consent })
const before = tickets().length
const res = await Promise.all([1, 2, 3].map(() => sf.markPaid({ sessionId: 'cs_par', invoiceId: 'in_p', invoiceUrl: 'u' })))
assert.equal(res.filter((r) => r.created).length, 1)
assert.equal(tickets().length, before + 1)
assert.ok((await sf.getFeatureDoc('c1', 'p4', 'news')).ticketId)
})