story-kit: merge 68_story_frontend_pipeline_state_stale_after_server_restart

This commit is contained in:
Dave
2026-02-23 13:33:33 +00:00
parent 2e224f059d
commit 46644a6bc9
3 changed files with 283 additions and 34 deletions

View File

@@ -588,6 +588,42 @@ pub fn validate_story_dirs(
mod tests {
use super::*;
#[test]
fn load_pipeline_state_loads_all_stages() {
let tmp = tempfile::tempdir().unwrap();
let root = tmp.path().to_path_buf();
for (stage, id) in &[
("1_upcoming", "10_story_upcoming"),
("2_current", "20_story_current"),
("3_qa", "30_story_qa"),
("4_merge", "40_story_merge"),
] {
let dir = root.join(".story_kit").join("work").join(stage);
fs::create_dir_all(&dir).unwrap();
fs::write(
dir.join(format!("{id}.md")),
format!("---\nname: {id}\ntest_plan: pending\n---\n"),
)
.unwrap();
}
let ctx = crate::http::context::AppContext::new_test(root);
let state = load_pipeline_state(&ctx).unwrap();
assert_eq!(state.upcoming.len(), 1);
assert_eq!(state.upcoming[0].story_id, "10_story_upcoming");
assert_eq!(state.current.len(), 1);
assert_eq!(state.current[0].story_id, "20_story_current");
assert_eq!(state.qa.len(), 1);
assert_eq!(state.qa[0].story_id, "30_story_qa");
assert_eq!(state.merge.len(), 1);
assert_eq!(state.merge[0].story_id, "40_story_merge");
}
#[test]
fn load_upcoming_returns_empty_when_no_dir() {
let tmp = tempfile::tempdir().unwrap();