Skip to content

Commit

Permalink
starters test
Browse files Browse the repository at this point in the history
  • Loading branch information
jondot committed Nov 14, 2024
1 parent dc817ad commit da60aed
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 4 deletions.
1 change: 0 additions & 1 deletion loco-new/tests/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
mod templates;
#[cfg(feature = "test-wizard")]
mod wizard;

pub mod assertion;
34 changes: 31 additions & 3 deletions loco-new/tests/wizard/new.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use loco::{
settings, wizard,
wizard::{AssetsOption, BackgroundOption, DBOption},
};
use rstest::rstest;
use uuid::Uuid;

struct TestDir {
Expand All @@ -30,8 +29,9 @@ impl Drop for TestDir {
}
}

#[rstest]
fn new_from_wizard(
#[cfg(feature = "test-wizard")]
#[rstest::rstest]
fn test_all_combinations(
#[values(DBOption::None, DBOption::Sqlite)] db: DBOption,
#[values(
BackgroundOption::Async,
Expand All @@ -43,6 +43,34 @@ fn new_from_wizard(
#[values(AssetsOption::Serverside, AssetsOption::Clientside, AssetsOption::None)]
asset: AssetsOption,
) {
test_combination(db, background, asset);
}

#[test]
fn test_starter_combinations() {
// lightweight service
test_combination(DBOption::None, BackgroundOption::None, AssetsOption::None);
// REST API
test_combination(
DBOption::Sqlite,
BackgroundOption::Async,
AssetsOption::None,
);
// SaaS, serverside
test_combination(
DBOption::Sqlite,
BackgroundOption::Async,
AssetsOption::Serverside,
);
// SaaS, clientside
test_combination(
DBOption::Sqlite,
BackgroundOption::Async,
AssetsOption::Clientside,
);
}

fn test_combination(db: DBOption, background: BackgroundOption, asset: AssetsOption) {
use std::collections::HashMap;

let test_dir = TestDir::new();
Expand Down

0 comments on commit da60aed

Please sign in to comment.