From 64a133684f8609ab7cb5eefd763be0762f7b8a5a Mon Sep 17 00:00:00 2001 From: simonsan <14062932+simonsan@users.noreply.github.com> Date: Thu, 22 Feb 2024 14:10:16 +0100 Subject: [PATCH] chore: cleanup crates --- crates/core/tests/activity_store.rs | 7 ---- crates/{core => server}/src/event.rs | 2 -- crates/server/src/lib.rs | 2 ++ src/commands/begin.rs | 51 ---------------------------- 4 files changed, 2 insertions(+), 60 deletions(-) rename crates/{core => server}/src/event.rs (96%) diff --git a/crates/core/tests/activity_store.rs b/crates/core/tests/activity_store.rs index 9aa3420c..a02690e8 100644 --- a/crates/core/tests/activity_store.rs +++ b/crates/core/tests/activity_store.rs @@ -185,13 +185,6 @@ fn test_activity_store_list_ended_activities_passes( Ok(()) } -#[rstest] -#[ignore = "We need to implement the archiving feature first."] -fn test_activity_store_list_archived_activities_passes() -> TestResult<()> { - // TODO!: We need to implement the archiving feature first. - todo!() -} - #[rstest] fn test_activity_store_list_all_activities_passes( activity_log_with_variety_content: (Vec, ActivityLog), diff --git a/crates/core/src/event.rs b/crates/server/src/event.rs similarity index 96% rename from crates/core/src/event.rs rename to crates/server/src/event.rs index 4a4a5e50..acbb8346 100644 --- a/crates/core/src/event.rs +++ b/crates/server/src/event.rs @@ -49,11 +49,9 @@ enum PaceEventType { // A more generalized way to handle any activity, whether it's a task, an intermission, or part of a Pomodoro session. This approach provides flexibility for future extensions. BeginActivity { activity_id: u32, - activity_type: ActivityType, }, EndActivity { activity_id: u32, - activity_type: ActivityType, }, // Additional system events diff --git a/crates/server/src/lib.rs b/crates/server/src/lib.rs index ff16137a..32156735 100644 --- a/crates/server/src/lib.rs +++ b/crates/server/src/lib.rs @@ -1 +1,3 @@ //! Server Library for pace + +pub(crate) mod event; diff --git a/src/commands/begin.rs b/src/commands/begin.rs index 18e4cbd1..5d116aca 100644 --- a/src/commands/begin.rs +++ b/src/commands/begin.rs @@ -49,23 +49,6 @@ impl Runnable for BeginCmd { } impl BeginCmd { - /// Create a new instance of the `begin` subcommand - pub fn new( - category: impl Into>, - time: impl Into>, - description: String, - tags: impl Into>>, - projects: impl Into>>, - ) -> Self { - Self { - category: category.into(), - time: time.into(), - description, - tags: tags.into(), - _projects: projects.into(), - } - } - /// Inner run implementation for the begin command pub fn inner_run(&self, config: &PaceConfig) -> Result<()> { let Self { @@ -121,37 +104,3 @@ impl BeginCmd { eyre::bail!("Failed to start {activity}"); } } - -// TODO!: Test pace-rs begin command -// #[cfg(test)] -// mod tests { - -// use std::env::temp_dir; - -// use abscissa_core::fs::create_dir_all; -// use eyre::Ok; - -// use super::*; - -// #[test] -// fn test_begin_subcommand_creates_activity_passes() -> Result<()> { -// let temp_dir = temp_dir(); -// let temp_file = temp_dir.join("activity_log.toml"); -// create_dir_all(temp_dir)?; - -// let cmd = BeginCmd::new( -// "Test::Category".to_string(), -// "22:00".to_string(), -// "Test description".to_string(), -// None, -// None, -// ); - -// let mut pace_config = PaceConfig::default(); -// pace_config.add_activity_log_path(temp_file.to_string_lossy().to_string()); - -// cmd.inner_run(&pace_config)?; - -// Ok(()) -// } -// }