Intelligence, Advanced Charting & Trading Platform
risk/chartnova-seven-track-safety-2026-10-21
diagnostics/chartnova-blank-screen-2026-10-15
diagnostics/chartnova-stage2-v27-preview-2026-10-15
docs/chartnova-stage1-reconcile-manifest-2026-10-15
feature/chartnova-ios-widget
feature/chartnova-light-catalog-lazy-series-2026-10-15
feature/chartnova-market-terminal
feature/chartnova-multimarket-chart-ws-foundation
feature/chartnova-neon-direct-history
feature/chartnova-neon-history
feature/paper-trading-risk-controls-2026-10-14
fix/alpha-vantage-live-payload
fix/chartnova-progressive-loading-2026-10-15
fix/live-proof-runner-cwd-2026-10-14
foundation/phase-0
foundation/postgres-core
main
ops/chartnova-emergency-rollback-2026-10-15
phase-1/candle-builder
phase-1/data-proof-artifact
phase-1/data-proof-metrics
phase-1/data-proof-report
phase-1/external-gates-state
phase-1/gold-api-fallback
phase-1/ingestion-pipeline
phase-1/live-proof-runner
phase-1/market-calendar
phase-1/market-domain
phase-1/neon-live-proof
phase-1/persistence-contract
phase-1/postgres-ci
phase-1/provider-adapters
phase-1/provider-recovery
phase-1/quality-propagation
phase-1/spike-detection
phase-1/xau-provider-adapter
risk/chartnova-alert-runtime-atomic-2026-10-22
risk/chartnova-atomic-outbox-2026-10-22
risk/chartnova-seven-track-safety-2026-10-21
safety/p0-triage-2026-10-13
| 1 | import test from 'node:test';import assert from 'node:assert/strict'; |
| 2 | import {quotaBudget,officialFreePlanBudget} from '../src/free-quota-budget.mjs'; |
| 3 | test('30 day navasan no-reserve arithmetic is precisely six hours',()=>{ |
| 4 | const r=officialFreePlanBudget('NAVASAN',{reserveFraction:0}); |
| 5 | assert.equal(r.mathematicallyMinimalMinutes,360);assert.equal(r.suggestedMinutes,360); |
| 6 | assert.equal(r.plannedCalls,120);assert.equal(r.guaranteedLatencyMs,null) |
| 7 | }); |
| 8 | test('31 day navasan floor 372 minutes',()=>assert.equal(officialFreePlanBudget('NAVASAN',{daysInMonth:31,reserveFraction:0}).mathematicallyMinimalMinutes,372)); |
| 9 | test('Gheymat one-call floor 5.76 min, two-call doubles',()=>{ |
| 10 | assert.equal(officialFreePlanBudget('GHEYMAT_ONLINE',{reserveFraction:0}).mathematicallyMinimalMinutes,5.76); |
| 11 | assert.equal(officialFreePlanBudget('GHEYMAT_ONLINE',{callsPerPoll:2,reserveFraction:0}).mathematicallyMinimalMinutes,11.52) |
| 12 | }); |
| 13 | test('reserve never overcommits quota, including odd windows',()=>{ |
| 14 | for(const calls of [1,5,17,120,250]){ |
| 15 | for(const k of [1,2,4]){ |
| 16 | try{const x=quotaBudget({calls,windowMinutes:1440,callsPerPoll:k,reserveFraction:0}); |
| 17 | assert.ok(x.plannedCalls<=calls);assert.ok(x.remainingCalls>=0); |
| 18 | assert.equal(x.latencyVerified,false); |
| 19 | }catch(e){assert.ok(e instanceof RangeError)} |
| 20 | } |
| 21 | } |
| 22 | }); |
| 23 | test('account/plan drift and unknown providers rejected, no asserted SLA',()=>{ |
| 24 | assert.throws(()=>officialFreePlanBudget('HIDDEN_PROVIDER')); |
| 25 | assert.throws(()=>officialFreePlanBudget('NAVASAN',{daysInMonth:32})); |
| 26 | assert.throws(()=>quotaBudget({calls:250,windowMinutes:1440,reserveFraction:1})); |
| 27 | }); |