T-209: tests
This commit is contained in:
parent
1eddd86850
commit
e6bc956e49
2 changed files with 169 additions and 0 deletions
|
|
@ -816,3 +816,39 @@ fn post_2200_timestamp_is_preserved_by_adapter_and_rejected_by_writer() {
|
|||
);
|
||||
assert!(!dir.path().join("events/year=2201").exists());
|
||||
}
|
||||
|
||||
/// Regression for T-209: the curated `ceoPosts` kind must be one of the `EventKind` values the
|
||||
/// downstream TypeScript and Python readers accept. With the old `"post"` label every curated post
|
||||
/// was unreachable through `store.events` / MCP `event_study` because `validateEventKinds` rejects
|
||||
/// unknown kinds and no reader can request `"post"`.
|
||||
#[test]
|
||||
fn event_kind_post_is_accepted_by_ts_and_python_event_kind_contracts() {
|
||||
const TS_READER: &str = include_str!("../../../libs/research/src/market-data-store-duckdb.ts");
|
||||
const TS_CONTRACT: &str = include_str!("../../../libs/research/src/market-data-store.ts");
|
||||
const PY_READER: &str = include_str!("../../../python/stockbot/data.py");
|
||||
|
||||
let ts_kinds_line = TS_READER
|
||||
.lines()
|
||||
.find(|l| l.starts_with("export const EVENT_KINDS"))
|
||||
.expect("EVENT_KINDS declaration in market-data-store-duckdb.ts");
|
||||
let ts_type_line = TS_CONTRACT
|
||||
.lines()
|
||||
.find(|l| l.starts_with("export type EventKind"))
|
||||
.expect("EventKind type in market-data-store.ts");
|
||||
let py_line = PY_READER
|
||||
.lines()
|
||||
.find(|l| l.starts_with("EventKind = Literal["))
|
||||
.expect("EventKind Literal in python/stockbot/data.py");
|
||||
|
||||
let quoted_single = format!("'{EVENT_KIND_POST}'");
|
||||
let quoted_double = format!("\"{EVENT_KIND_POST}\"");
|
||||
assert!(ts_kinds_line.contains("ed_single), "TS EVENT_KINDS lacks {quoted_single}: {ts_kinds_line}");
|
||||
assert!(ts_type_line.contains("ed_single), "TS EventKind lacks {quoted_single}: {ts_type_line}");
|
||||
assert!(py_line.contains("ed_double), "Python EventKind lacks {quoted_double}: {py_line}");
|
||||
|
||||
// Both readers must glob every `.parquet` sibling in a year partition so the posts file
|
||||
// (`part-posts.parquet`) is read alongside filings/earnings (`part.parquet`).
|
||||
assert!(TS_READER.contains("'events/year=*/*.parquet'"));
|
||||
assert!(PY_READER.contains("/events/year=*/*.parquet"));
|
||||
assert!(!PY_READER.contains("/events/year=*/part.parquet"));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue