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 f6577fe
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Typikon

**Typikon lets you use markdown to write your online books.**
Typikon lets you use markdown to write your online books.

---

Expand All @@ -13,7 +13,9 @@

---

A static website rendering tool similar to mdbook and hugo, but it focuses only on rendering markdown into an online book, and is easier to use than the other tools.
### Introduce

Typikon name derived from [Typikon](https://en.wikipedia.org/wiki/Typikon) Book, the a static website rendering tool similar to mdbook and hugo, but it focuses only on rendering markdown into an online book, and is easier to use than the other tools.

---

Expand Down
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 f6577fe

Please sign in to comment.