Fix financial taxonomy snapshot normalization
This commit is contained in:
@@ -1811,6 +1811,56 @@ describe('financial taxonomy internals', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('aggregates persisted detail rows when legacy snapshots are missing dimension arrays', () => {
|
||||
const snapshot = {
|
||||
...createSnapshot({
|
||||
filingId: 21,
|
||||
filingType: '10-K',
|
||||
filingDate: '2026-02-22',
|
||||
statement: 'income',
|
||||
periods: [
|
||||
{ id: '2025-fy', periodStart: '2025-01-01', periodEnd: '2025-12-31', periodLabel: '2025 FY' }
|
||||
]
|
||||
}),
|
||||
detail_rows: {
|
||||
income: {
|
||||
revenue: [{
|
||||
key: 'revenue_detail',
|
||||
parentSurfaceKey: 'revenue',
|
||||
label: 'Revenue Detail',
|
||||
conceptKey: 'us-gaap:RevenueDetail',
|
||||
qname: 'us-gaap:RevenueDetail',
|
||||
namespaceUri: 'http://fasb.org/us-gaap/2024',
|
||||
localName: 'RevenueDetail',
|
||||
unit: 'iso4217:USD',
|
||||
values: { '2025-fy': 123_000_000 },
|
||||
sourceFactIds: undefined,
|
||||
isExtension: false,
|
||||
dimensionsSummary: undefined,
|
||||
residualFlag: false
|
||||
} as unknown as FilingTaxonomySnapshotRecord['detail_rows']['income'][string][number]]
|
||||
},
|
||||
balance: {},
|
||||
cash_flow: {},
|
||||
equity: {},
|
||||
comprehensive_income: {}
|
||||
}
|
||||
} satisfies FilingTaxonomySnapshotRecord;
|
||||
|
||||
const rows = __financialTaxonomyInternals.aggregateDetailRows({
|
||||
snapshots: [snapshot],
|
||||
statement: 'income',
|
||||
selectedPeriodIds: new Set(['2025-fy'])
|
||||
});
|
||||
|
||||
expect(rows.revenue).toHaveLength(1);
|
||||
expect(rows.revenue?.[0]).toMatchObject({
|
||||
key: 'revenue_detail',
|
||||
sourceFactIds: [],
|
||||
dimensionsSummary: []
|
||||
});
|
||||
});
|
||||
|
||||
it('builds normalization metadata from snapshot fiscal pack and counts', () => {
|
||||
const snapshot = {
|
||||
...createSnapshot({
|
||||
|
||||
Reference in New Issue
Block a user