import { describe, expect, it, mock } from 'bun:test'; import { __statementInternals, fetchFilingMetricsForFilings, hydrateFilingStatementSnapshot, fetchPrimaryFilingText, normalizeSecDocumentText, resolvePrimaryFilingUrl, trimSecDocumentTextForPrompt } from './sec'; describe('sec filing text helpers', () => { it('normalizes html filing content into plain text', () => { const html = `

Quarterly Report

Revenue & margin improved.

See 'Risk Factors' section.
`; const normalized = normalizeSecDocumentText(html); expect(normalized).toContain('Quarterly Report'); expect(normalized).toContain('Revenue & margin improved.'); expect(normalized).toContain('See \'Risk Factors\' section.'); expect(normalized).not.toContain('