()
| 770 | |
| 771 | #[tokio::test] |
| 772 | async fn test_task_builder_with_template() { |
| 773 | use crate::test_utils::TestGitRepository; |
| 774 | |
| 775 | let test_repo = TestGitRepository::new().unwrap(); |
| 776 | test_repo.init_with_commit().unwrap(); |
| 777 | let current_dir = test_repo.path().to_path_buf(); |
| 778 | |
| 779 | // Create template with frontmatter |
| 780 | let template_content = |
| 781 | "---\ndescription: A feature template\n---\n# Feature Template\n\n{{PROMPT}}"; |
| 782 | test_repo |
| 783 | .create_file(".tsk/templates/feat.md", template_content) |
| 784 | .unwrap(); |
| 785 | |
| 786 | let ctx = AppContext::builder().build(); |
| 787 | |
| 788 | let task = TaskBuilder::new() |
| 789 | .repo_root(current_dir) |
| 790 | .name("test-feature".to_string()) |
| 791 | .task_type("feat".to_string()) |
| 792 | .prompt(Some("My new feature".to_string())) |
| 793 | .build(&ctx) |
| 794 | .await |
| 795 | .unwrap(); |
| 796 | |
| 797 | assert_eq!(task.task_type, "feat"); |
| 798 | verify_instructions_content(&ctx, &task, "Feature Template").await; |
| 799 | verify_instructions_content(&ctx, &task, "My new feature").await; |
| 800 | |
| 801 | // Verify frontmatter is stripped from instructions |
| 802 | let instructions_path = ctx |
| 803 | .tsk_env() |
| 804 | .data_dir() |
| 805 | .join("tasks") |
| 806 | .join(&task.id) |
| 807 | .join(&task.instructions_file); |
| 808 | let content = crate::file_system::read_file(&instructions_path) |
| 809 | .await |
| 810 | .unwrap(); |
| 811 | assert!( |
| 812 | !content.contains("description: A feature template"), |
| 813 | "Frontmatter should be stripped from instructions" |
| 814 | ); |
| 815 | } |
| 816 | |
| 817 | #[tokio::test] |
| 818 | async fn test_deprecated_description_placeholder_still_works() { |
nothing calls this directly
no test coverage detected