feat: full pattern matrix — M1 complete, M2 LLM chat, 30+ pattern files #10
1 changed files with 52 additions and 2 deletions
|
|
@ -11,6 +11,22 @@ pub enum SourceOs {
|
|||
Unknown,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum Tier {
|
||||
Free,
|
||||
Paid,
|
||||
Premium,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum NotificationLevel {
|
||||
Off,
|
||||
BadgeOnly,
|
||||
BadgeAndToast,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct MigrationConfig {
|
||||
pub source_os: SourceOs,
|
||||
|
|
@ -37,14 +53,14 @@ impl Default for OllamaConfig {
|
|||
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct DisplayConfig {
|
||||
pub show_notifications: bool,
|
||||
pub notification_level: NotificationLevel,
|
||||
pub quiet_mode: bool,
|
||||
}
|
||||
|
||||
impl Default for DisplayConfig {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
show_notifications: true,
|
||||
notification_level: NotificationLevel::BadgeAndToast,
|
||||
quiet_mode: false,
|
||||
}
|
||||
}
|
||||
|
|
@ -55,6 +71,7 @@ pub struct RobinConfig {
|
|||
pub migration: Option<MigrationConfig>,
|
||||
pub ollama: OllamaConfig,
|
||||
pub display: DisplayConfig,
|
||||
pub tier: Tier,
|
||||
}
|
||||
|
||||
impl Default for RobinConfig {
|
||||
|
|
@ -63,6 +80,7 @@ impl Default for RobinConfig {
|
|||
migration: None,
|
||||
ollama: OllamaConfig::default(),
|
||||
display: DisplayConfig::default(),
|
||||
tier: Tier::Free,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -136,4 +154,36 @@ mod tests {
|
|||
let deserialized: RobinConfig = toml::from_str(&serialized).unwrap();
|
||||
assert!(!deserialized.needs_onboarding());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn notification_level_default_is_badge_and_toast() {
|
||||
let config = RobinConfig::default();
|
||||
assert!(matches!(
|
||||
config.display.notification_level,
|
||||
NotificationLevel::BadgeAndToast
|
||||
));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn tier_default_is_free() {
|
||||
let config = RobinConfig::default();
|
||||
assert!(matches!(config.tier, Tier::Free));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn notification_level_roundtrips_toml() {
|
||||
let config = RobinConfig {
|
||||
display: DisplayConfig {
|
||||
notification_level: NotificationLevel::BadgeOnly,
|
||||
quiet_mode: false,
|
||||
},
|
||||
..Default::default()
|
||||
};
|
||||
let toml = toml::to_string_pretty(&config).unwrap();
|
||||
let back: RobinConfig = toml::from_str(&toml).unwrap();
|
||||
assert!(matches!(
|
||||
back.display.notification_level,
|
||||
NotificationLevel::BadgeOnly
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue