T-210: M2.3s — Implement MarketDataStore.macroAsOf, crossSection, QuestDB fx('1m'), and copilot 1m routing
This commit is contained in:
parent
a3a31f7562
commit
0c33d8ae19
23 changed files with 2440 additions and 82 deletions
|
|
@ -2,7 +2,12 @@ import { beforeEach, describe, expect, it, mock } from 'bun:test';
|
|||
import { QuestDBHealthMonitor } from '../src/health';
|
||||
import { QuestDBInfluxWriter } from '../src/influx-writer';
|
||||
import { QuestDBQueryBuilder } from '../src/query-builder';
|
||||
import { QuestDBSchemaManager } from '../src/schema';
|
||||
import {
|
||||
applyM2IntradayDDL,
|
||||
getM2IntradayDDL,
|
||||
M2_INTRADAY_TABLE_NAMES,
|
||||
QuestDBSchemaManager,
|
||||
} from '../src/schema';
|
||||
import type { OHLCVData, QuestDBClientConfig, TradeData } from '../src/types';
|
||||
|
||||
// Simple in-memory QuestDB client for testing
|
||||
|
|
@ -474,6 +479,41 @@ describe('QuestDB', () => {
|
|||
expect(stats.min_timestamp).toBeDefined();
|
||||
expect(stats.max_timestamp).toBeDefined();
|
||||
});
|
||||
|
||||
it('applyM2IntradayDDL executes getM2IntradayDDL() for bars_1m, fx_1m, and bar_revisions without altering initializeDatabase()', async () => {
|
||||
const executed: string[] = [];
|
||||
const mockQueryable = {
|
||||
query: mock(async (sql: string) => {
|
||||
executed.push(sql);
|
||||
return { rows: [], count: 0 };
|
||||
}),
|
||||
};
|
||||
|
||||
const expectedDdl = getM2IntradayDDL();
|
||||
const result = await applyM2IntradayDDL(mockQueryable);
|
||||
expect(result.appliedTables).toEqual([...M2_INTRADAY_TABLE_NAMES]);
|
||||
expect(executed).toEqual([
|
||||
expectedDdl.bars_1m,
|
||||
expectedDdl.fx_1m,
|
||||
expectedDdl.bar_revisions,
|
||||
]);
|
||||
|
||||
// Subset option executes only requested tables in deduplicated order.
|
||||
executed.length = 0;
|
||||
const subset = await applyM2IntradayDDL(mockQueryable, {
|
||||
tables: ['fx_1m', 'bars_1m', 'fx_1m'],
|
||||
});
|
||||
expect(subset.appliedTables).toEqual(['fx_1m', 'bars_1m']);
|
||||
expect(executed).toEqual([expectedDdl.fx_1m, expectedDdl.bars_1m]);
|
||||
|
||||
// Rejects unknown or empty table lists.
|
||||
await expect(applyM2IntradayDDL(mockQueryable, { tables: [] })).rejects.toThrow();
|
||||
await expect(
|
||||
applyM2IntradayDDL(mockQueryable, {
|
||||
tables: ['unknown_table' as unknown as 'bars_1m'],
|
||||
})
|
||||
).rejects.toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
describe('QuestDBHealthMonitor', () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue