fix: use proper setting to initialize time remaining in new method
This commit is contained in:
+6
-8
@@ -63,7 +63,7 @@ impl Termato {
|
||||
prior_state: TimerState::Work,
|
||||
is_running: false,
|
||||
duration_in_secs: work_mins * SECONDS_PER_MIN,
|
||||
time_remaining_in_sec: break_mins * SECONDS_PER_MIN,
|
||||
time_remaining_in_sec: work_mins * SECONDS_PER_MIN,
|
||||
show_help: false,
|
||||
}
|
||||
}
|
||||
@@ -125,8 +125,6 @@ impl Termato {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: I think we can refactor this to be more like iced.rs
|
||||
// basically implement an elem like approach.
|
||||
fn main() -> Result<(), io::Error> {
|
||||
enable_raw_mode()?;
|
||||
stdout().execute(EnterAlternateScreen)?;
|
||||
@@ -262,15 +260,15 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn termato_when_called_it_should_return_expected_starting_state() {
|
||||
let result = Termato::new(1, 1);
|
||||
let result = Termato::new(25, 5);
|
||||
|
||||
assert_eq!(result.work_mins, 1);
|
||||
assert_eq!(result.break_mins, 1);
|
||||
assert_eq!(result.work_mins, 25);
|
||||
assert_eq!(result.break_mins, 5);
|
||||
assert_eq!(result.state, TimerState::Work);
|
||||
assert_eq!(result.prior_state, TimerState::Work);
|
||||
assert!(!result.is_running);
|
||||
assert_eq!(result.duration_in_secs, 60);
|
||||
assert_eq!(result.time_remaining_in_sec, 60);
|
||||
assert_eq!(result.duration_in_secs, 1500);
|
||||
assert_eq!(result.time_remaining_in_sec, 1500);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user