From d7d2377772e31fafb56f8107a6a22df4a26846d9 Mon Sep 17 00:00:00 2001 From: omagdy Date: Wed, 23 Jul 2025 07:53:14 +0300 Subject: refactor+feat: Did overhaul refactoring for how I model each server data and also add a feat to propagate write commands to replicas --- tests/test_commands.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'tests') diff --git a/tests/test_commands.rs b/tests/test_commands.rs index e71db38..86b9cbc 100644 --- a/tests/test_commands.rs +++ b/tests/test_commands.rs @@ -141,7 +141,8 @@ mod command_parser_tests { /// Tests for the command execution logic in `RedisCommands::execute`. mod command_execution_tests { - use codecrafters_redis::{resp_commands::RedisCommands, Config}; + use codecrafters_redis::resp_commands::RedisCommands; + use codecrafters_redis::server::RedisServer; use std::time::Duration; use super::*; @@ -149,8 +150,10 @@ mod command_execution_tests { /// Helper to parse and execute a command against a cache. fn run_command(cache: &SharedCache, args: &[&str]) -> Vec { let command = RedisCommands::from(build_command_from_str_slice(args)); - let config = Arc::new(Some(Config::default())); - command.execute(Arc::clone(cache), config) + let mut server = RedisServer::master(); + server.set_cache(cache); + + command.execute(Arc::new(Mutex::new(server))) } #[test] -- cgit v1.2.3