phase-8g: add sqllite.

This commit is contained in:
Sai Kiran Vella
2026-06-05 23:34:25 -04:00
committed by saikiranvella
parent d1556f2a67
commit c7e39c3e4e
20 changed files with 2514 additions and 239 deletions
+6 -6
View File
@@ -9,7 +9,7 @@ import Fastify from 'fastify';
import cors from '@fastify/cors';
import { CallsController } from '../server/controllers/calls.controller';
import type { ScreenerEngine } from '../server/services/ScreenerEngine';
import type { YahooFinanceClient } from '../server/clients/YahooFinanceClient';
import type { CalendarService } from '../server/services/CalendarService';
import type { MarketCall, ScreenerResult, MarketContext, CreateCallInput } from '../server/types';
// ── Stubs ────────────────────────────────────────────────────────────────────
@@ -35,9 +35,9 @@ const stubEngine = {
screenTickers: async () => EMPTY_RESULT,
} as unknown as ScreenerEngine;
const stubYahoo = {
fetchCalendarEvents: async () => null,
} as unknown as YahooFinanceClient;
const stubCalendar = {
getEvents: async () => ({ events: [], tickers: [] }),
} as unknown as CalendarService;
// In-memory MarketCallRepository stub
function makeRepoStub() {
@@ -81,7 +81,7 @@ function makeRepoStub() {
async function buildTestApp() {
const app = Fastify({ logger: false });
await app.register(cors, { origin: '*' });
new CallsController(makeRepoStub() as any, stubEngine, stubYahoo).register(app);
new CallsController(makeRepoStub() as any, stubEngine, stubCalendar).register(app);
await app.ready();
return app;
}
@@ -210,5 +210,5 @@ test('GET /api/calls/calendar with no calls → 200 empty events', async () => {
const app = await buildTestApp();
const res = await app.inject({ method: 'GET', url: '/api/calls/calendar' });
assert.equal(res.statusCode, 200);
assert.deepEqual(res.json(), { events: [] });
assert.deepEqual(res.json(), { events: [], tickers: [] });
});