Clear M1 milestone bugs (T-37, T-39, T-41, T-42, T-44, T-45, T-46, T-48, T-49, T-51, T-52)

This commit is contained in:
Boki 2026-11-27 16:11:57 -05:00
parent 199f7beecd
commit 9e259ca43b
18 changed files with 255 additions and 34 deletions

View file

@ -230,10 +230,27 @@ describe('pipeline builder edge cases', () => {
expect(
(buildQmBarSpansPipeline()[2] as { $group: Record<string, unknown> }).$group.barCount
).toEqual({
$sum: 1,
$sum: {
$cond: [{ $ne: ['$normalizedDate', null] }, 1, 0],
},
});
});
test('stored source IDs with leading/trailing spaces are not merged with trimmed IDs', async () => {
const reader: BarSpanAggregateReader = {
aggregate<T extends Record<string, unknown>>(): T[] {
return [
{ _id: 'AAPL.US', firstBarDate: '2020-01-02', lastBarDate: '2024-12-31', barCount: 10 },
{ _id: ' AAPL.US ', firstBarDate: '2021-01-04', lastBarDate: '2022-12-30', barCount: 5 },
] as unknown as T[];
},
};
const result = await computeBarSpans(reader, { sources: ['eod'] });
expect(result.index.get('eod', 'AAPL.US')?.barCount).toBe(10);
expect(result.index.get('eod', ' AAPL.US ')?.barCount).toBe(5);
expect(result.index.sizeForSource('eod')).toBe(2);
});
test('dispatcher rejects unknown sources', () => {
expect(() => buildBarSpansPipeline('ib' as unknown as BarSpanSource)).toThrow(RangeError);
});