Fix 25 tests for work/ directory restructure (story 60)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1304,12 +1304,12 @@ mod tests {
|
||||
let repo = tmp.path();
|
||||
init_git_repo(repo);
|
||||
|
||||
let upcoming = repo.join(".story_kit/stories/upcoming");
|
||||
let current_dir = repo.join(".story_kit/current");
|
||||
let upcoming = repo.join(".story_kit/work/1_upcoming");
|
||||
let current_dir = repo.join(".story_kit/work/2_current");
|
||||
fs::create_dir_all(&upcoming).unwrap();
|
||||
fs::create_dir_all(¤t_dir).unwrap();
|
||||
|
||||
let story_file = upcoming.join("10_my_story.md");
|
||||
let story_file = upcoming.join("10_story_my_story.md");
|
||||
fs::write(&story_file, "---\nname: Test\ntest_plan: pending\n---\n").unwrap();
|
||||
|
||||
Command::new("git")
|
||||
@@ -1323,11 +1323,11 @@ mod tests {
|
||||
.output()
|
||||
.unwrap();
|
||||
|
||||
move_story_to_current(repo, "10_my_story").unwrap();
|
||||
move_story_to_current(repo, "10_story_my_story").unwrap();
|
||||
|
||||
assert!(!story_file.exists(), "upcoming file should be gone");
|
||||
assert!(
|
||||
current_dir.join("10_my_story.md").exists(),
|
||||
current_dir.join("10_story_my_story.md").exists(),
|
||||
"current/ file should exist"
|
||||
);
|
||||
}
|
||||
@@ -1341,18 +1341,18 @@ mod tests {
|
||||
let repo = tmp.path();
|
||||
init_git_repo(repo);
|
||||
|
||||
let current_dir = repo.join(".story_kit/current");
|
||||
let current_dir = repo.join(".story_kit/work/2_current");
|
||||
fs::create_dir_all(¤t_dir).unwrap();
|
||||
fs::write(
|
||||
current_dir.join("11_my_story.md"),
|
||||
current_dir.join("11_story_my_story.md"),
|
||||
"---\nname: Test\ntest_plan: pending\n---\n",
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
// Should succeed without error even though there's nothing to move
|
||||
move_story_to_current(repo, "11_my_story").unwrap();
|
||||
move_story_to_current(repo, "11_story_my_story").unwrap();
|
||||
|
||||
assert!(current_dir.join("11_my_story.md").exists());
|
||||
assert!(current_dir.join("11_story_my_story.md").exists());
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -1377,12 +1377,12 @@ mod tests {
|
||||
let repo = tmp.path();
|
||||
init_git_repo(repo);
|
||||
|
||||
let bugs_dir = repo.join(".story_kit/bugs");
|
||||
let current_dir = repo.join(".story_kit/current");
|
||||
fs::create_dir_all(&bugs_dir).unwrap();
|
||||
let upcoming_dir = repo.join(".story_kit/work/1_upcoming");
|
||||
let current_dir = repo.join(".story_kit/work/2_current");
|
||||
fs::create_dir_all(&upcoming_dir).unwrap();
|
||||
fs::create_dir_all(¤t_dir).unwrap();
|
||||
|
||||
let bug_file = bugs_dir.join("bug-1-test.md");
|
||||
let bug_file = upcoming_dir.join("1_bug_test.md");
|
||||
fs::write(&bug_file, "# Bug 1\n").unwrap();
|
||||
|
||||
Command::new("git")
|
||||
@@ -1396,11 +1396,11 @@ mod tests {
|
||||
.output()
|
||||
.unwrap();
|
||||
|
||||
move_story_to_current(repo, "bug-1-test").unwrap();
|
||||
move_story_to_current(repo, "1_bug_test").unwrap();
|
||||
|
||||
assert!(!bug_file.exists(), "bugs/ file should be gone");
|
||||
assert!(!bug_file.exists(), "upcoming/ file should be gone");
|
||||
assert!(
|
||||
current_dir.join("bug-1-test.md").exists(),
|
||||
current_dir.join("1_bug_test.md").exists(),
|
||||
"current/ file should exist"
|
||||
);
|
||||
}
|
||||
@@ -1414,10 +1414,10 @@ mod tests {
|
||||
let repo = tmp.path();
|
||||
init_git_repo(repo);
|
||||
|
||||
let current_dir = repo.join(".story_kit/current");
|
||||
let current_dir = repo.join(".story_kit/work/2_current");
|
||||
fs::create_dir_all(¤t_dir).unwrap();
|
||||
|
||||
let bug_in_current = current_dir.join("bug-2-test.md");
|
||||
let bug_in_current = current_dir.join("2_bug_test.md");
|
||||
fs::write(&bug_in_current, "# Bug 2\n").unwrap();
|
||||
|
||||
Command::new("git")
|
||||
@@ -1431,9 +1431,9 @@ mod tests {
|
||||
.output()
|
||||
.unwrap();
|
||||
|
||||
close_bug_to_archive(repo, "bug-2-test").unwrap();
|
||||
close_bug_to_archive(repo, "2_bug_test").unwrap();
|
||||
|
||||
let archive_path = repo.join(".story_kit/bugs/archive/bug-2-test.md");
|
||||
let archive_path = repo.join(".story_kit/work/5_archived/2_bug_test.md");
|
||||
assert!(!bug_in_current.exists(), "current/ file should be gone");
|
||||
assert!(archive_path.exists(), "archive file should exist");
|
||||
}
|
||||
@@ -1447,10 +1447,10 @@ mod tests {
|
||||
let repo = tmp.path();
|
||||
init_git_repo(repo);
|
||||
|
||||
let bugs_dir = repo.join(".story_kit/bugs");
|
||||
fs::create_dir_all(&bugs_dir).unwrap();
|
||||
let upcoming_dir = repo.join(".story_kit/work/1_upcoming");
|
||||
fs::create_dir_all(&upcoming_dir).unwrap();
|
||||
|
||||
let bug_file = bugs_dir.join("bug-3-test.md");
|
||||
let bug_file = upcoming_dir.join("3_bug_test.md");
|
||||
fs::write(&bug_file, "# Bug 3\n").unwrap();
|
||||
|
||||
Command::new("git")
|
||||
@@ -1464,19 +1464,19 @@ mod tests {
|
||||
.output()
|
||||
.unwrap();
|
||||
|
||||
close_bug_to_archive(repo, "bug-3-test").unwrap();
|
||||
close_bug_to_archive(repo, "3_bug_test").unwrap();
|
||||
|
||||
let archive_path = repo.join(".story_kit/bugs/archive/bug-3-test.md");
|
||||
assert!(!bug_file.exists(), "bugs/ file should be gone");
|
||||
let archive_path = repo.join(".story_kit/work/5_archived/3_bug_test.md");
|
||||
assert!(!bug_file.exists(), "upcoming/ file should be gone");
|
||||
assert!(archive_path.exists(), "archive file should exist");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn item_type_from_id_detects_types() {
|
||||
assert_eq!(item_type_from_id("bug-1-test"), "bug");
|
||||
assert_eq!(item_type_from_id("spike-1-research"), "spike");
|
||||
assert_eq!(item_type_from_id("50_my_story"), "story");
|
||||
assert_eq!(item_type_from_id("1_simple"), "story");
|
||||
assert_eq!(item_type_from_id("1_bug_test"), "bug");
|
||||
assert_eq!(item_type_from_id("1_spike_research"), "spike");
|
||||
assert_eq!(item_type_from_id("50_story_my_story"), "story");
|
||||
assert_eq!(item_type_from_id("1_story_simple"), "story");
|
||||
}
|
||||
|
||||
// ── git_stage_and_commit tests ─────────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user