-
Notifications
You must be signed in to change notification settings - Fork 256
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #609 from loco-rs/task-args
move task args from BTreeMap to struct
- Loading branch information
Showing
17 changed files
with
138 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,17 @@ | ||
use blo::app::App; | ||
use loco_rs::testing; | ||
|
||
use loco_rs::boot::run_task; | ||
use migration::Migrator; | ||
use loco_rs::{boot::run_task, task, testing}; | ||
use serial_test::serial; | ||
use std::collections::BTreeMap; | ||
|
||
#[tokio::test] | ||
#[serial] | ||
async fn test_can_seed_data() { | ||
let boot = testing::boot_test::<App, Migrator>().await.unwrap(); | ||
|
||
let vars = BTreeMap::new(); | ||
async fn test_can_run_foo_task() { | ||
let boot = testing::boot_test::<App>().await.unwrap(); | ||
|
||
assert!( | ||
run_task::<App>(&boot.app_context, Some(&"foo".to_string()), &vars) | ||
.await | ||
.is_ok() | ||
); | ||
assert!(run_task::<App>( | ||
&boot.app_context, | ||
Some(&"foo".to_string()), | ||
&task::Vars::default() | ||
) | ||
.await | ||
.is_ok()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
mod foo; | ||
mod seed; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,17 @@ | ||
use std::collections::BTreeMap; | ||
|
||
use blo::app::App; | ||
use loco_rs::{boot::run_task, testing}; | ||
use loco_rs::{boot::run_task, task, testing}; | ||
use serial_test::serial; | ||
|
||
#[tokio::test] | ||
#[serial] | ||
async fn test_can_seed_data() { | ||
let boot = testing::boot_test::<App>().await.unwrap(); | ||
|
||
let vars = BTreeMap::new(); | ||
|
||
assert!( | ||
run_task::<App>(&boot.app_context, Some(&"seed_data".to_string()), &vars) | ||
.await | ||
.is_ok() | ||
); | ||
assert!(run_task::<App>( | ||
&boot.app_context, | ||
Some(&"seed_data".to_string()), | ||
&task::Vars::default() | ||
) | ||
.await | ||
.is_ok()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.