Skip to content

Commit

Permalink
tasks: add before and after test
Browse files Browse the repository at this point in the history
  • Loading branch information
sandydoo committed Nov 5, 2024
1 parent c9e7848 commit d46116a
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions devenv-tasks/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1194,7 +1194,7 @@ mod test {
}

#[tokio::test]
async fn test_enter_shell_tasks() -> Result<(), Error> {
async fn test_before_and_after_tasks() -> Result<(), Error> {
let script1 = create_script(
"#!/bin/sh\necho 'Task 1 is running' && sleep 0.5 && echo 'Task 1 completed'",
)?;
Expand All @@ -1207,22 +1207,23 @@ mod test {

let tasks = Tasks::new(
Config::try_from(json!({
"roots": ["devenv:enterShell"],
"roots": ["myapp:task_1"],
"tasks": [
{
"name": "devenv:enterShell",
"name": "myapp:task_1",
"command": script1.to_str().unwrap(),
},
{
"name": "devenv:python:poetry",
"before": ["devenv:enterShell"],
"command": script2.to_str().unwrap()
"name": "myapp:task_3",
"after": ["myapp:task_1"],
"command": script3.to_str().unwrap()
},
{
"name": "app:custom",
"before": ["devenv:python:poetry"],
"command": script3.to_str().unwrap()
}
"name": "myapp:task_2",
"before": ["myapp:task_3"],
"after": ["myapp:task_1"],
"command": script2.to_str().unwrap()
},
]
}))
.unwrap(),
Expand All @@ -1238,8 +1239,7 @@ mod test {
(name1, TaskStatus::Completed(TaskCompleted::Success(_, _))),
(name2, TaskStatus::Completed(TaskCompleted::Success(_, _))),
(name3, TaskStatus::Completed(TaskCompleted::Success(_, _)))
// ] if name1 == "app:custom" && name2 == "devenv:python:poetry" && name3 == "devenv:enterShell"
] if name1 == "devenv:enterShell" && name2 == "devenv:python:poetry" && name3 == "app:custom"
] if name1 == "myapp:task_1" && name2 == "myapp:task_2" && name3 == "myapp:task_3"
);
Ok(())
}
Expand Down

0 comments on commit d46116a

Please sign in to comment.