import { test } from 'node:test'; import assert from 'node:assert/strict'; import { priceFor, formatMonthly } from './price-mode.logic.ts'; test('priceFor picks the price the mode names', () => { const prices = { std: '16', founder: '8' }; assert.equal(priceFor(prices, 'founder'), '8'); assert.equal(priceFor(prices, 'list'), '16'); }); test('priceFor returns null when the card lacks that price', () => { // A page rendered with the founder window shut carries no founder value. assert.equal(priceFor({ std: '16', founder: null }, 'founder'), null); assert.equal(priceFor({ std: null, founder: '8' }, 'list'), null); }); test('priceFor treats an empty attribute as absent', () => { // getAttribute on a present-but-empty attribute returns '', not null, and // writing that into the radio value would send an empty tier price. assert.equal(priceFor({ std: '', founder: '8' }, 'list'), null); }); test('formatMonthly matches what the server renders', () => { assert.equal(formatMonthly('16'), '$16/mo'); assert.equal(formatMonthly('8'), '$8/mo'); });