refactor(config): cadence-keyed plan id, add getTierAmount, drop per-tier helcimPlanId

This commit is contained in:
Jennie Robinson Faber 2026-04-18 17:19:05 +01:00
parent 35197c465b
commit be0e6e7699
3 changed files with 64 additions and 159 deletions

View file

@ -0,0 +1,20 @@
import { describe, it, expect } from 'vitest'
import { getTierAmount } from '../../../server/config/contributions.js'
describe('getTierAmount', () => {
it('returns monthly amount as-is', () => {
expect(getTierAmount({ amount: 5 }, 'monthly')).toBe(5)
})
it('returns annual amount as base * 10', () => {
expect(getTierAmount({ amount: 5 }, 'annual')).toBe(50)
})
it('returns annual amount for $50 tier', () => {
expect(getTierAmount({ amount: 50 }, 'annual')).toBe(500)
})
it('defaults cadence to monthly', () => {
expect(getTierAmount({ amount: 15 })).toBe(15)
})
})