story-kit: merge 77_bug_create_bug_file_writes_no_yaml_front_matter

This commit is contained in:
Dave
2026-02-23 14:56:08 +00:00
parent 532031102d
commit 6e9b5da458
2 changed files with 23 additions and 11 deletions

View File

@@ -238,6 +238,10 @@ pub fn create_bug_file(
.to_string();
let mut content = String::new();
content.push_str("---\n");
content.push_str(&format!("name: \"{}\"\n", name.replace('"', "\\\"")));
content.push_str("test_plan: pending\n");
content.push_str("---\n\n");
content.push_str(&format!("# Bug {bug_number}: {name}\n\n"));
content.push_str("## Description\n\n");
content.push_str(description);
@@ -1266,6 +1270,10 @@ mod tests {
.join(".story_kit/work/1_upcoming/1_bug_login_crash.md");
assert!(filepath.exists());
let contents = fs::read_to_string(&filepath).unwrap();
assert!(
contents.starts_with("---\nname: \"Login Crash\"\ntest_plan: pending\n---"),
"bug file must start with YAML front matter"
);
assert!(contents.contains("# Bug 1: Login Crash"));
assert!(contents.contains("## Description"));
assert!(contents.contains("The login page crashes on submit."));
@@ -1305,6 +1313,10 @@ mod tests {
let filepath = tmp.path().join(".story_kit/work/1_upcoming/1_bug_some_bug.md");
let contents = fs::read_to_string(&filepath).unwrap();
assert!(
contents.starts_with("---\nname: \"Some Bug\"\ntest_plan: pending\n---"),
"bug file must have YAML front matter"
);
assert!(contents.contains("- [ ] Bug is fixed and verified"));
}
}