-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
59 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -372,3 +372,62 @@ pub fn app() -> Command { | |
]), | ||
) | ||
} | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use super::*; | ||
|
||
#[test] | ||
fn test_send_args_subject_content() { | ||
let args = vec![ | ||
"pigeon", | ||
"send", | ||
"[email protected]", | ||
"[email protected]", | ||
"--subject", | ||
"Test subject", | ||
"--content", | ||
"This is a test message (plaintext).", | ||
]; | ||
let app = app(); | ||
let matches = app.get_matches_from(args); | ||
let subcommand_matches = matches.subcommand_matches("send"); | ||
assert!(subcommand_matches.is_some()); | ||
} | ||
|
||
#[test] | ||
fn test_send_args_text_file_html_file() { | ||
let args = vec![ | ||
"pigeon", | ||
"send", | ||
"[email protected]", | ||
"[email protected]", | ||
"--subject", | ||
"Test subject", | ||
"--text-file", | ||
"./test_data/message.txt", | ||
"--html-file", | ||
"./test_data/message.html", | ||
]; | ||
let app = app(); | ||
let matches = app.get_matches_from(args); | ||
let subcommand_matches = matches.subcommand_matches("send"); | ||
assert!(subcommand_matches.is_some()); | ||
} | ||
|
||
#[test] | ||
fn test_send_args_message_file() { | ||
let args = vec![ | ||
"pigeon", | ||
"send", | ||
"[email protected]", | ||
"[email protected]", | ||
"--message-file", | ||
"./test_data/message.yaml", | ||
]; | ||
let app = app(); | ||
let matches = app.get_matches_from(args); | ||
let subcommand_matches = matches.subcommand_matches("send"); | ||
assert!(subcommand_matches.is_some()); | ||
} | ||
} |