import assert from 'node:assert/strict'; import { readFileSync } from 'node:fs'; import { fileURLToPath } from 'node:url'; import test from 'node:test'; const plan = readFileSync(fileURLToPath(new URL('../routes/admin/billing/+page.svelte', import.meta.url)), 'utf8'); const actions = readFileSync(fileURLToPath(new URL('./components/products/ProductProcessingActions.svelte', import.meta.url)), 'utf8'); const features = plan.split('const creditFeatures = [', 2)[1]?.split('] as const', 1)[0] ?? ''; test('plan processing costs show only the three selectable product outputs', () => { assert.match(features, /key: 'title_ai'|key: "title_ai"/); assert.match(features, /key: 'description_ai'|key: "description_ai"/); assert.match(features, /key: 'seo_meta_ai'|key: "seo_meta_ai"/); assert.doesNotMatch(features, /openai_token_k|campaign_copy|product_processing/); }); test('decimal values are allowed and loaded from company-effective pricing', () => { assert.match(plan, /step="0\.0001"/); assert.match(plan, /\\d\{1,4\}/); assert.match(actions, /\/api\/billing\/processing-costs/); assert.match(actions, /effectiveCosts\[option\.type\]/); });