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,
|
username: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(tarpaulin_include))]
|
||||||
impl KeyringStorage {
|
impl KeyringStorage {
|
||||||
/// ### new
|
/// ### new
|
||||||
///
|
///
|
||||||
@@ -50,6 +51,7 @@ impl KeyringStorage {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(not(tarpaulin_include))]
|
||||||
impl KeyStorage for KeyringStorage {
|
impl KeyStorage for KeyringStorage {
|
||||||
/// ### get_key
|
/// ### get_key
|
||||||
///
|
///
|
||||||
|
|||||||
@@ -303,6 +303,10 @@ mod tests {
|
|||||||
assert_eq!(component.states.focus, true);
|
assert_eq!(component.states.focus, true);
|
||||||
component.blur();
|
component.blur();
|
||||||
assert_eq!(component.states.focus, false);
|
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
|
// Increment list index
|
||||||
component.states.list_index += 1;
|
component.states.list_index += 1;
|
||||||
assert_eq!(component.states.list_index, 1);
|
assert_eq!(component.states.list_index, 1);
|
||||||
|
|||||||
@@ -307,6 +307,10 @@ mod tests {
|
|||||||
assert_eq!(component.states.focus, true);
|
assert_eq!(component.states.focus, true);
|
||||||
component.blur();
|
component.blur();
|
||||||
assert_eq!(component.states.focus, false);
|
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
|
// Increment list index
|
||||||
component.states.list_index += 1;
|
component.states.list_index += 1;
|
||||||
assert_eq!(component.states.list_index, 1);
|
assert_eq!(component.states.list_index, 1);
|
||||||
|
|||||||
@@ -342,6 +342,7 @@ mod tests {
|
|||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
use crossterm::event::KeyEvent;
|
use crossterm::event::KeyEvent;
|
||||||
|
use tui::style::Color;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_ui_layout_components_input_text() {
|
fn test_ui_layout_components_input_text() {
|
||||||
@@ -362,6 +363,10 @@ mod tests {
|
|||||||
assert_eq!(component.states.focus, true);
|
assert_eq!(component.states.focus, true);
|
||||||
component.blur();
|
component.blur();
|
||||||
assert_eq!(component.states.focus, false);
|
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
|
// Get value
|
||||||
assert_eq!(component.get_value(), Payload::Text(String::from("home")));
|
assert_eq!(component.get_value(), Payload::Text(String::from("home")));
|
||||||
// RenderData
|
// RenderData
|
||||||
|
|||||||
@@ -310,6 +310,7 @@ mod tests {
|
|||||||
use crate::ui::layout::props::{TableBuilder, TextParts, TextSpan};
|
use crate::ui::layout::props::{TableBuilder, TextParts, TextSpan};
|
||||||
|
|
||||||
use crossterm::event::{KeyCode, KeyEvent};
|
use crossterm::event::{KeyCode, KeyEvent};
|
||||||
|
use tui::style::Color;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_ui_layout_components_logbox() {
|
fn test_ui_layout_components_logbox() {
|
||||||
@@ -336,6 +337,10 @@ mod tests {
|
|||||||
assert_eq!(component.states.focus, true);
|
assert_eq!(component.states.focus, true);
|
||||||
component.blur();
|
component.blur();
|
||||||
assert_eq!(component.states.focus, false);
|
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
|
// Increment list index
|
||||||
component.states.list_index += 1;
|
component.states.list_index += 1;
|
||||||
assert_eq!(component.states.list_index, 1);
|
assert_eq!(component.states.list_index, 1);
|
||||||
|
|||||||
@@ -197,6 +197,12 @@ mod tests {
|
|||||||
))
|
))
|
||||||
.build(),
|
.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
|
// Get value
|
||||||
assert_eq!(component.get_value(), Payload::None);
|
assert_eq!(component.get_value(), Payload::None);
|
||||||
// Event
|
// Event
|
||||||
|
|||||||
@@ -155,6 +155,7 @@ mod tests {
|
|||||||
use crate::ui::layout::props::{TextParts, TextSpan};
|
use crate::ui::layout::props::{TextParts, TextSpan};
|
||||||
|
|
||||||
use crossterm::event::{KeyCode, KeyEvent};
|
use crossterm::event::{KeyCode, KeyEvent};
|
||||||
|
use tui::style::Color;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_ui_layout_components_progress_bar() {
|
fn test_ui_layout_components_progress_bar() {
|
||||||
@@ -168,6 +169,12 @@ mod tests {
|
|||||||
);
|
);
|
||||||
// Get value
|
// Get value
|
||||||
assert_eq!(component.get_value(), Payload::None);
|
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
|
// Event
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
component.on(InputEvent::Key(KeyEvent::from(KeyCode::Delete))),
|
component.on(InputEvent::Key(KeyEvent::from(KeyCode::Delete))),
|
||||||
|
|||||||
@@ -284,6 +284,10 @@ mod tests {
|
|||||||
assert_eq!(component.states.focus, true);
|
assert_eq!(component.states.focus, true);
|
||||||
component.blur();
|
component.blur();
|
||||||
assert_eq!(component.states.focus, false);
|
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
|
// Get value
|
||||||
assert_eq!(component.get_value(), Payload::Unsigned(1));
|
assert_eq!(component.get_value(), Payload::Unsigned(1));
|
||||||
// Handle events
|
// Handle events
|
||||||
|
|||||||
@@ -167,6 +167,7 @@ mod tests {
|
|||||||
use crate::ui::layout::props::{TableBuilder, TextParts, TextSpan};
|
use crate::ui::layout::props::{TableBuilder, TextParts, TextSpan};
|
||||||
|
|
||||||
use crossterm::event::{KeyCode, KeyEvent};
|
use crossterm::event::{KeyCode, KeyEvent};
|
||||||
|
use tui::style::Color;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_ui_layout_components_table() {
|
fn test_ui_layout_components_table() {
|
||||||
@@ -184,6 +185,12 @@ mod tests {
|
|||||||
))
|
))
|
||||||
.build(),
|
.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
|
// Get value
|
||||||
assert_eq!(component.get_value(), Payload::None);
|
assert_eq!(component.get_value(), Payload::None);
|
||||||
// Event
|
// Event
|
||||||
|
|||||||
@@ -178,6 +178,12 @@ mod tests {
|
|||||||
))
|
))
|
||||||
.build(),
|
.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
|
// Get value
|
||||||
assert_eq!(component.get_value(), Payload::None);
|
assert_eq!(component.get_value(), Payload::None);
|
||||||
// Event
|
// Event
|
||||||
|
|||||||
@@ -133,6 +133,7 @@ mod tests {
|
|||||||
use crate::ui::layout::props::TextParts;
|
use crate::ui::layout::props::TextParts;
|
||||||
|
|
||||||
use crossterm::event::{KeyCode, KeyEvent};
|
use crossterm::event::{KeyCode, KeyEvent};
|
||||||
|
use tui::style::Color;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_ui_layout_components_title() {
|
fn test_ui_layout_components_title() {
|
||||||
@@ -141,6 +142,12 @@ mod tests {
|
|||||||
.with_texts(TextParts::new(Some(String::from("Title")), None))
|
.with_texts(TextParts::new(Some(String::from("Title")), None))
|
||||||
.build(),
|
.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
|
// Get value
|
||||||
assert_eq!(component.get_value(), Payload::None);
|
assert_eq!(component.get_value(), Payload::None);
|
||||||
// Event
|
// Event
|
||||||
|
|||||||
Reference in New Issue
Block a user