use crate::application::theme_service; use crate::infrastructure::theme_repository::StaticThemeRepository; use serde::Serialize; #[derive(Serialize)] pub struct ThemeDto { pub id: String, pub label: String, } #[tauri::command] pub fn list_themes() -> Vec { let repo = StaticThemeRepository; theme_service::list_themes(&repo) .into_iter() .map(|t| ThemeDto { id: t.id, label: t.label }) .collect() } #[tauri::command] pub fn get_theme_css(id: String) -> Option { let repo = StaticThemeRepository; theme_service::get_theme_css(&repo, &id) } #[cfg(test)] mod tests { use super::*; #[test] fn list_themes_returns_non_empty() { let themes = list_themes(); assert!(!themes.is_empty()); } #[test] fn list_themes_ids_are_non_empty() { for theme in list_themes() { assert!(!theme.id.is_empty()); assert!(!theme.label.is_empty()); } } #[test] fn get_theme_css_known() { assert!(get_theme_css("dark".into()).is_some()); assert!(get_theme_css("shell-indigo".into()).is_some()); } #[test] fn get_theme_css_unknown_returns_none() { assert!(get_theme_css("does-not-exist".into()).is_none()); } }