Skip to content

Commit

Permalink
test: add cli & main unit testting.
Browse files Browse the repository at this point in the history
  • Loading branch information
auula committed Jul 1, 2024
1 parent aa1849b commit e3bc388
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/main_test.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
use typikon::{cli::Command, utils::Logger};

#[test]
fn test_handle_init_command() {
// Mock args and log

let mut log = Logger::console_log();

// Test handle_init_command
for cmd in &[
"build".to_string(),
"init".to_string(),
"theme".to_string(),
"help".to_string(),
] {
match Command::from_str(&cmd) {
Command::Build => typikon::cli::handle_build_command(&["build".to_string()], &mut log),
Command::Theme => {
typikon::cli::handle_build_command(&["--get=xxxxxxx.git".to_string()], &mut log)
}
Command::Init => {
typikon::cli::handle_build_command(&["--path=/xxxxx".to_string()], &mut log)
}
Command::Help => typikon::cli::handle_build_command(&["theme".to_string()], &mut log),
Command::Unknown(_) => typikon::cli::out_banner_string(),
}
}
}

0 comments on commit e3bc388

Please sign in to comment.