//! Composer Enter must send chat to the selected friend, not only slash commands. use onionwire::tui::{composer_enter, ComposerAction, SlashCmd, WipeKind}; #[test] fn enter_plain_text_is_send() { assert_eq!( composer_enter("hello wire"), Some(ComposerAction::Send("hello wire".into())) ); } #[test] fn enter_trims_but_sends() { assert_eq!( composer_enter(" hi there "), Some(ComposerAction::Send("hi there".into())) ); } #[test] fn enter_empty_does_nothing() { assert_eq!(composer_enter(""), None); assert_eq!(composer_enter(" "), None); } #[test] fn enter_slash_cmds_are_not_chat() { assert_eq!( composer_enter("/wipe"), Some(ComposerAction::Cmd(SlashCmd::Wipe(WipeKind::Messages))) ); assert_eq!( composer_enter("/who"), Some(ComposerAction::Cmd(SlashCmd::Who)) ); } #[test] fn enter_unknown_slash_is_not_chat() { assert_eq!( composer_enter("/nope"), Some(ComposerAction::UnknownSlash("/nope".into())) ); }