Fix financial taxonomy snapshot normalization
This commit is contained in:
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user