//! Re-exports of case-directory artefact filenames from their //! canonical source-of-truth locations. //! //! Tests that need to read, write, or assert the absence of per-case //! artefacts (`oneliner.json`, `.closed`, `document.json`, //! `analysis_input.json`) pull these names from here instead of //! inlining string literals. If the server renames a sidecar in the //! future, test call-sites fail to compile instead of silently //! asserting against the old name. use std::path::Path; pub use doctate_common::ONELINER_FILENAME; pub use doctate_server::analyze::{DOCUMENT_FILE, Document}; pub use doctate_server::paths::CLOSE_MARKER; /// Legacy filename of the per-case analysis input. The server no /// longer writes or reads it — the in-flight marker lives in `InFlight` /// and the payload travels with the `AnalyzeJob`. This constant is /// retained only for tests that simulate an orphan file from a /// pre-refactor server. New tests should not seed this file. pub const ANALYSIS_INPUT_FILE: &str = "analysis_input.json"; /// Seed a `document.json` for tests. `covered_mtime` is the RFC3339 /// snapshot mtime the document is supposed to "cover" — for tests that /// don't care about the auto-trigger state machine, pass any RFC3339 /// string (e.g. `"1970-01-01T00:00:00Z"`). pub fn write_document_for_test(case_dir: &Path, content_md: &str, covered_mtime: &str) { let doc = Document { covered_mtime: covered_mtime.to_owned(), written_at: doctate_common::timestamp::now_rfc3339(), backend_id: "test".to_owned(), content_md: content_md.to_owned(), }; let bytes = serde_json::to_vec_pretty(&doc).expect("serialize test Document"); std::fs::write(case_dir.join(DOCUMENT_FILE), bytes).expect("write test document.json"); }