Fix financial taxonomy snapshot normalization

This commit is contained in:
2026-03-13 19:01:56 -04:00
parent b1c9c0ef08
commit 30977dc15f
16 changed files with 1273 additions and 156 deletions

View File

@@ -160,6 +160,28 @@ describe('statement view model', () => {
expect(child?.kind === 'surface' && child.expanded).toBe(true);
});
it('does not throw when legacy surface rows are missing source arrays', () => {
const malformedRow = {
...createSurfaceRow({ key: 'revenue', label: 'Revenue', category: 'revenue', values: { p1: 100 } }),
sourceConcepts: undefined,
sourceRowKeys: undefined
} as unknown as SurfaceFinancialRow;
const model = buildStatementTree({
surfaceKind: 'income_statement',
rows: [malformedRow],
statementDetails: null,
categories: [],
searchQuery: 'revenue',
expandedRowKeys: new Set()
});
expect(model.sections[0]?.nodes[0]).toMatchObject({
kind: 'surface',
row: { key: 'revenue' }
});
});
it('keeps not meaningful rows visible and resolves selections for surface and detail nodes', () => {
const rows = [
createSurfaceRow({