Hydrate options feed across live routes

This commit is contained in:
dirtydishes 2026-05-04 02:57:20 -04:00
parent cfc3836815
commit b4f87b50d2
2 changed files with 70 additions and 8 deletions

View file

@ -10,6 +10,7 @@ import {
getAlertWindowAnchorTs,
getOptionTableSnapshot,
getLiveFeedStatus,
getLiveManifest,
normalizeAlertSeverity,
nextFlowFilterPopoverState,
projectPausableTapeState,
@ -38,6 +39,42 @@ const makeAlert = (overrides: Record<string, unknown> = {}) =>
...overrides
}) as any;
describe("live manifest", () => {
it("includes options on every live route", () => {
const filters = buildDefaultFlowFilters();
for (const pathname of ["/", "/tape", "/signals", "/charts", "/replay"]) {
expect(
getLiveManifest(pathname, "SPY", 60000, filters).some(
(subscription) => subscription.channel === "options"
)
).toBe(true);
}
});
it("dedupes tape options subscription", () => {
const tapeOptionsSubscriptions = getLiveManifest(
"/tape",
"SPY",
60000,
buildDefaultFlowFilters()
).filter((subscription) => subscription.channel === "options");
expect(tapeOptionsSubscriptions).toHaveLength(1);
});
it("keeps option filters on baseline subscription", () => {
const filters = {
...buildDefaultFlowFilters(),
minNotional: 125_000
};
const optionsSubscription = getLiveManifest("/signals", "SPY", 60000, filters).find(
(subscription) => subscription.channel === "options"
);
expect(optionsSubscription?.filters).toBe(filters);
});
});
describe("live tape pausable helpers", () => {
it("queues new items while paused and flushes them on resume", () => {
let state = reducePausableTapeData(