mirror of
https://github.com/veeso/termscp.git
synced 2025-12-07 09:36:00 -08:00
Improved coverage
This commit is contained in:
@@ -39,6 +39,7 @@ pub struct KeyringStorage {
|
||||
username: String,
|
||||
}
|
||||
|
||||
#[cfg(not(tarpaulin_include))]
|
||||
impl KeyringStorage {
|
||||
/// ### new
|
||||
///
|
||||
@@ -50,6 +51,7 @@ impl KeyringStorage {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(tarpaulin_include))]
|
||||
impl KeyStorage for KeyringStorage {
|
||||
/// ### get_key
|
||||
///
|
||||
|
||||
@@ -303,6 +303,10 @@ mod tests {
|
||||
assert_eq!(component.states.focus, true);
|
||||
component.blur();
|
||||
assert_eq!(component.states.focus, false);
|
||||
// Update
|
||||
let props = component.get_props().with_foreground(Color::Red).build();
|
||||
assert_eq!(component.update(props), Msg::None);
|
||||
assert_eq!(component.props.foreground, Color::Red);
|
||||
// Increment list index
|
||||
component.states.list_index += 1;
|
||||
assert_eq!(component.states.list_index, 1);
|
||||
|
||||
@@ -307,6 +307,10 @@ mod tests {
|
||||
assert_eq!(component.states.focus, true);
|
||||
component.blur();
|
||||
assert_eq!(component.states.focus, false);
|
||||
// Update
|
||||
let props = component.get_props().with_foreground(Color::Red).build();
|
||||
assert_eq!(component.update(props), Msg::None);
|
||||
assert_eq!(component.props.foreground, Color::Red);
|
||||
// Increment list index
|
||||
component.states.list_index += 1;
|
||||
assert_eq!(component.states.list_index, 1);
|
||||
|
||||
@@ -342,6 +342,7 @@ mod tests {
|
||||
use super::*;
|
||||
|
||||
use crossterm::event::KeyEvent;
|
||||
use tui::style::Color;
|
||||
|
||||
#[test]
|
||||
fn test_ui_layout_components_input_text() {
|
||||
@@ -362,6 +363,10 @@ mod tests {
|
||||
assert_eq!(component.states.focus, true);
|
||||
component.blur();
|
||||
assert_eq!(component.states.focus, false);
|
||||
// Update
|
||||
let props = component.get_props().with_foreground(Color::Red).build();
|
||||
assert_eq!(component.update(props), Msg::None);
|
||||
assert_eq!(component.props.foreground, Color::Red);
|
||||
// Get value
|
||||
assert_eq!(component.get_value(), Payload::Text(String::from("home")));
|
||||
// RenderData
|
||||
|
||||
@@ -310,6 +310,7 @@ mod tests {
|
||||
use crate::ui::layout::props::{TableBuilder, TextParts, TextSpan};
|
||||
|
||||
use crossterm::event::{KeyCode, KeyEvent};
|
||||
use tui::style::Color;
|
||||
|
||||
#[test]
|
||||
fn test_ui_layout_components_logbox() {
|
||||
@@ -336,6 +337,10 @@ mod tests {
|
||||
assert_eq!(component.states.focus, true);
|
||||
component.blur();
|
||||
assert_eq!(component.states.focus, false);
|
||||
// Update
|
||||
let props = component.get_props().with_foreground(Color::Red).build();
|
||||
assert_eq!(component.update(props), Msg::None);
|
||||
assert_eq!(component.props.foreground, Color::Red);
|
||||
// Increment list index
|
||||
component.states.list_index += 1;
|
||||
assert_eq!(component.states.list_index, 1);
|
||||
|
||||
@@ -197,6 +197,12 @@ mod tests {
|
||||
))
|
||||
.build(),
|
||||
);
|
||||
component.active();
|
||||
component.blur();
|
||||
// Update
|
||||
let props = component.get_props().with_foreground(Color::Red).build();
|
||||
assert_eq!(component.update(props), Msg::None);
|
||||
assert_eq!(component.props.foreground, Color::Red);
|
||||
// Get value
|
||||
assert_eq!(component.get_value(), Payload::None);
|
||||
// Event
|
||||
|
||||
@@ -155,6 +155,7 @@ mod tests {
|
||||
use crate::ui::layout::props::{TextParts, TextSpan};
|
||||
|
||||
use crossterm::event::{KeyCode, KeyEvent};
|
||||
use tui::style::Color;
|
||||
|
||||
#[test]
|
||||
fn test_ui_layout_components_progress_bar() {
|
||||
@@ -168,6 +169,12 @@ mod tests {
|
||||
);
|
||||
// Get value
|
||||
assert_eq!(component.get_value(), Payload::None);
|
||||
component.active();
|
||||
component.blur();
|
||||
// Update
|
||||
let props = component.get_props().with_foreground(Color::Red).build();
|
||||
assert_eq!(component.update(props), Msg::None);
|
||||
assert_eq!(component.props.foreground, Color::Red);
|
||||
// Event
|
||||
assert_eq!(
|
||||
component.on(InputEvent::Key(KeyEvent::from(KeyCode::Delete))),
|
||||
|
||||
@@ -284,6 +284,10 @@ mod tests {
|
||||
assert_eq!(component.states.focus, true);
|
||||
component.blur();
|
||||
assert_eq!(component.states.focus, false);
|
||||
// Update
|
||||
let props = component.get_props().with_foreground(Color::Red).build();
|
||||
assert_eq!(component.update(props), Msg::None);
|
||||
assert_eq!(component.props.foreground, Color::Red);
|
||||
// Get value
|
||||
assert_eq!(component.get_value(), Payload::Unsigned(1));
|
||||
// Handle events
|
||||
|
||||
@@ -167,6 +167,7 @@ mod tests {
|
||||
use crate::ui::layout::props::{TableBuilder, TextParts, TextSpan};
|
||||
|
||||
use crossterm::event::{KeyCode, KeyEvent};
|
||||
use tui::style::Color;
|
||||
|
||||
#[test]
|
||||
fn test_ui_layout_components_table() {
|
||||
@@ -184,6 +185,12 @@ mod tests {
|
||||
))
|
||||
.build(),
|
||||
);
|
||||
component.active();
|
||||
component.blur();
|
||||
// Update
|
||||
let props = component.get_props().with_foreground(Color::Red).build();
|
||||
assert_eq!(component.update(props), Msg::None);
|
||||
assert_eq!(component.props.foreground, Color::Red);
|
||||
// Get value
|
||||
assert_eq!(component.get_value(), Payload::None);
|
||||
// Event
|
||||
|
||||
@@ -178,6 +178,12 @@ mod tests {
|
||||
))
|
||||
.build(),
|
||||
);
|
||||
component.active();
|
||||
component.blur();
|
||||
// Update
|
||||
let props = component.get_props().with_foreground(Color::Red).build();
|
||||
assert_eq!(component.update(props), Msg::None);
|
||||
assert_eq!(component.props.foreground, Color::Red);
|
||||
// Get value
|
||||
assert_eq!(component.get_value(), Payload::None);
|
||||
// Event
|
||||
|
||||
@@ -133,6 +133,7 @@ mod tests {
|
||||
use crate::ui::layout::props::TextParts;
|
||||
|
||||
use crossterm::event::{KeyCode, KeyEvent};
|
||||
use tui::style::Color;
|
||||
|
||||
#[test]
|
||||
fn test_ui_layout_components_title() {
|
||||
@@ -141,6 +142,12 @@ mod tests {
|
||||
.with_texts(TextParts::new(Some(String::from("Title")), None))
|
||||
.build(),
|
||||
);
|
||||
component.active();
|
||||
component.blur();
|
||||
// Update
|
||||
let props = component.get_props().with_foreground(Color::Red).build();
|
||||
assert_eq!(component.update(props), Msg::None);
|
||||
assert_eq!(component.props.foreground, Color::Red);
|
||||
// Get value
|
||||
assert_eq!(component.get_value(), Payload::None);
|
||||
// Event
|
||||
|
||||
Reference in New Issue
Block a user