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

@ -116,6 +116,54 @@ describe('Pass 1 classifier edge cases', () => {
]);
});
test('routes source codes longer than 32 chars to unresolved and rejects them in SQL generation (T-44)', () => {
const exact32 = 'A'.repeat(32);
const tooLong33 = 'B'.repeat(33);
const result = classifySourceExchanges([
{ source: 'eod', code: exact32, operatingMic: 'XNAS' },
{ source: 'eod', code: tooLong33, operatingMic: 'XNAS' },
]);
expect(result.mapped.map(row => row.sourceCode)).toEqual([exact32]);
expect(result.unresolved.map(row => [row.sourceCode, row.reason])).toEqual([
[tooLong33, 'source_code_too_long'],
]);
expect(() =>
generateExchangeSeedSql({
mappings: [
{
source: 'eod',
sourceCode: tooLong33,
role: 'primary_venue',
mic: 'XNAS',
countryIso: 'US',
method: 'operating_mic',
},
],
})
).toThrow(/length must be between 1 and 32/);
});
test('deduplicates identical (source, source_code) rows and rejects conflicting duplicates in SQL generation (T-45)', () => {
const row = {
source: 'eod' as const,
sourceCode: 'NASDAQ',
role: 'primary_venue' as const,
mic: 'XNAS',
countryIso: 'US',
method: 'operating_mic' as const,
};
const sql = generateExchangeSeedSql({ mappings: [row, { ...row }] });
expect(sql.match(/'eod', 'NASDAQ'/g)).toHaveLength(1);
expect(() =>
generateExchangeSeedSql({
mappings: [row, { ...row, mic: 'XNYS' }],
})
).toThrow(/Conflicting duplicate exchange_source_map row/);
});
test('classification output is identical for every rotation of the input', () => {
const records = [
{ source: 'eod' as const, code: 'TO', operatingMic: 'XTSE', name: 'Toronto' },