Pause sync for private profiles

This commit is contained in:
2026-05-08 09:32:57 -04:00
parent 3fe2346305
commit 6bf1b674ac
2 changed files with 22 additions and 1 deletions
+16
View File
@@ -17,6 +17,7 @@ fn new_private_profile_command_creates_private_profile() -> Result<(), Box<dyn E
};
assert_eq!(profile.kind(), &ProfileKind::Private);
assert_eq!(profile.sync_policy(), ProfileSyncPolicy::Paused);
assert_eq!(&snapshot.active_profile_id, profile.id());
assert_eq!(snapshot.active_profile_name, "Private");
assert_eq!(snapshot.command_query, "");
@@ -46,6 +47,21 @@ fn private_profiles_do_not_record_history() -> Result<(), Box<dyn Error>> {
Ok(())
}
#[test]
fn private_profile_starts_with_sync_paused() -> Result<(), Box<dyn Error>> {
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<dyn Error>> {
let mut core = BrowserCore::new(InitialBrowserConfig::ely_defaults()?)?;
+6 -1
View File
@@ -52,13 +52,18 @@ pub struct Profile {
impl Profile {
#[must_use]
pub fn new(name: impl Into<String>, 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,
}
}