diff --git a/crates/ely_browser_core/tests/profiles.rs b/crates/ely_browser_core/tests/profiles.rs index 5fb07f2..dc85334 100644 --- a/crates/ely_browser_core/tests/profiles.rs +++ b/crates/ely_browser_core/tests/profiles.rs @@ -17,6 +17,7 @@ fn new_private_profile_command_creates_private_profile() -> Result<(), Box Result<(), Box> { Ok(()) } +#[test] +fn private_profile_starts_with_sync_paused() -> Result<(), Box> { + let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?; + let private_profile_id = core.create_profile("Private", 0x807d72, ProfileKind::Private)?; + let snapshot = core.snapshot()?; + let Some(private_profile) = + snapshot.profiles.iter().find(|profile| profile.id() == &private_profile_id) + else { + return Err("missing private profile".into()); + }; + + assert_eq!(private_profile.sync_policy(), ProfileSyncPolicy::Paused); + Ok(()) +} + #[test] fn profile_sync_policy_can_pause_one_profile() -> Result<(), Box> { let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?; diff --git a/crates/ely_domain/src/profile.rs b/crates/ely_domain/src/profile.rs index 58b8721..c69e752 100644 --- a/crates/ely_domain/src/profile.rs +++ b/crates/ely_domain/src/profile.rs @@ -52,13 +52,18 @@ pub struct Profile { impl Profile { #[must_use] pub fn new(name: impl Into, color_hex: u32, kind: ProfileKind) -> Self { + let sync_policy = match kind { + ProfileKind::Standard => ProfileSyncPolicy::Enabled, + ProfileKind::Private => ProfileSyncPolicy::Paused, + }; + Self { id: ProfileId::new(), name: name.into(), color_hex, kind, download_policy: DownloadPolicy::ask_every_time(), - sync_policy: ProfileSyncPolicy::default(), + sync_policy, } }