Stripe: Einmalpreis News-Einrichtung 30 €
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
85bee3190c
commit
16fbb03c13
4 files changed
+43
-8
No files matched your search
@@ -242,3 +242,21 @@ test('Spiegel: termStartAt aus Metadaten (Wechsel), sonst Leistungsbeginn; stora
|
||||
assert.equal(doc.termStartAt, '2026-10-05T10:00:00.000Z')
|
||||
assert.equal(doc.storageUnits, 3)
|
||||
})
|
||||
|
||||
test('news_einrichtung_einmalpreis', async () => {
|
||||
const before = st.calls.length
|
||||
const id = await ensurePrice('newsSetup')
|
||||
const calls = st.calls.slice(before)
|
||||
const created = calls.filter((c) => c.method === 'POST' && c.path === '/v1/prices')
|
||||
assert.equal(created.length, 1)
|
||||
assert.equal(created[0].body['unit_amount'], '3000')
|
||||
assert.equal(created[0].body['lookup_key'], 'webklar_news_einrichtung_3000')
|
||||
assert.ok(!Object.keys(created[0].body).some((k) => k.startsWith('recurring')), 'kein recurring')
|
||||
assert.equal(st.prices.get(id).recurring, null)
|
||||
const products = calls.filter((c) => c.method === 'POST' && c.path === '/v1/products')
|
||||
assert.equal(products[0].body['metadata[webklar]'], 'news-einrichtung')
|
||||
// zweiter Aufruf: kein zweiter Preis (auch ohne Cache per lookup_key gefunden)
|
||||
const again = st.calls.length
|
||||
assert.equal(await ensurePrice('newsSetup'), id)
|
||||
assert.equal(st.calls.slice(again).filter((c) => c.method === 'POST').length, 0)
|
||||
})
|
||||
Reference in new issue
Block a user