MCPcopy Create free account
hub / github.com/dtormoen/tsk-tsk / test_task_builder_repository_copy

Function test_task_builder_repository_copy

src/task_builder.rs:985–1019  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

983
984 #[tokio::test]
985 async fn test_task_builder_repository_copy() {
986 use crate::test_utils::TestGitRepository;
987
988 let test_repo = TestGitRepository::new().unwrap();
989 test_repo.init_with_commit().unwrap();
990
991 // Add some files to verify they get copied
992 test_repo
993 .create_file("src/main.rs", "fn main() {}")
994 .unwrap();
995 test_repo
996 .create_file("Cargo.toml", "[package]\nname = \"test\"")
997 .unwrap();
998 test_repo.stage_all().unwrap();
999 test_repo.commit("Add source files").unwrap();
1000
1001 let ctx = AppContext::builder().build();
1002
1003 let task = TaskBuilder::new()
1004 .repo_root(test_repo.path().to_path_buf())
1005 .name("copy-test".to_string())
1006 .prompt(Some("Test repository copy".to_string()))
1007 .build(&ctx)
1008 .await
1009 .unwrap();
1010
1011 // Verify repository was copied to the correct location
1012 let task_dir = ctx.tsk_env().task_dir(&task.id);
1013 let copied_repo = task_dir.join("repo");
1014
1015 assert!(copied_repo.exists());
1016 assert!(copied_repo.join("src/main.rs").exists());
1017 assert!(copied_repo.join("Cargo.toml").exists());
1018 assert!(copied_repo.join(".git").exists());
1019 }
1020
1021 #[tokio::test]
1022 async fn test_task_builder_creates_output_directory() {

Callers

nothing calls this directly

Calls 11

init_with_commitMethod · 0.80
create_fileMethod · 0.80
stage_allMethod · 0.80
commitMethod · 0.80
promptMethod · 0.80
repo_rootMethod · 0.80
pathMethod · 0.80
task_dirMethod · 0.80
tsk_envMethod · 0.80
buildMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected