test: mock AnthropicClient in analyze tests to prevent live API calls

This commit is contained in:
Kazuma
2026-06-08 12:08:37 -04:00
parent 76c2a671f4
commit ad1c3fe3c9
31 changed files with 415 additions and 171 deletions
+26
View File
@@ -0,0 +1,26 @@
/**
* Number and currency formatting utilities.
*/
/** Formats a P/E ratio — e.g. 22.5 → "22.5x", null → "—" */
export function fmtPE(v: number | null | undefined): string {
return v != null ? v + 'x' : '—';
}
/** Full currency format — e.g. 1234.5 → "$1,234.50" */
export function fmt(n: number | null | undefined): string {
return n != null
? new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD' }).format(n)
: '—';
}
/** Compact currency format (no cents) — e.g. 1234.5 → "$1,235" */
export function fmtShort(n: number | null | undefined): string {
return n != null
? new Intl.NumberFormat('en-US', {
style: 'currency',
currency: 'USD',
maximumFractionDigits: 0,
}).format(n)
: '—';
}