Fix filings ticker scope consistency

This commit is contained in:
2026-03-14 19:16:04 -04:00
parent ac3b036c93
commit 61b072d31f
3 changed files with 309 additions and 54 deletions

View File

@@ -467,6 +467,47 @@ if (process.env.RUN_TASK_WORKFLOW_E2E === '1') {
expect(task.payload.tags).toEqual(['semis', 'ai']);
});
it('scopes the filings endpoint by ticker while leaving the global endpoint mixed', async () => {
if (!sqliteClient) {
throw new Error('sqlite client not initialized');
}
seedFilingRecord(sqliteClient, {
ticker: 'NVDA',
accessionNumber: '0000000000-26-000110',
filingType: '10-Q',
filingDate: '2026-03-12',
companyName: 'NVIDIA Corporation'
});
seedFilingRecord(sqliteClient, {
ticker: 'MSFT',
accessionNumber: '0000000000-26-000111',
filingType: '10-K',
filingDate: '2026-03-11',
companyName: 'Microsoft Corporation'
});
const scoped = await jsonRequest('GET', '/api/filings?ticker=NVDA&limit=120');
expect(scoped.response.status).toBe(200);
const scopedFilings = (scoped.json as {
filings: Array<{ ticker: string }>;
}).filings;
expect(scopedFilings.length).toBeGreaterThan(0);
expect(scopedFilings.every((filing) => filing.ticker === 'NVDA')).toBe(true);
const global = await jsonRequest('GET', '/api/filings?limit=120');
expect(global.response.status).toBe(200);
const globalTickers = new Set((global.json as {
filings: Array<{ ticker: string }>;
}).filings.map((filing) => filing.ticker));
expect(globalTickers.has('NVDA')).toBe(true);
expect(globalTickers.has('MSFT')).toBe(true);
});
it('updates coverage status and archives while appending status-change journal history', async () => {
const created = await jsonRequest('POST', '/api/watchlist', {
ticker: 'amd',