package com.peachpasswords.ui.pairing import org.junit.Assert.assertEquals import org.junit.Assert.assertFalse import org.junit.Assert.assertTrue import org.junit.Test class BackgroundSyncChoiceTest { @Test fun `successful pairing prompts before navigation`() { assertTrue(shouldPromptForBackgroundSync(pairingSucceeded = true)) assertFalse(shouldPromptForBackgroundSync(pairingSucceeded = false)) } @Test fun `back uses the recommended background default when notification is available`() { assertEquals( true, backgroundSyncChoice( BackgroundSyncAction.DISMISS, notificationsAvailable = true, ), ) } @Test fun `secondary action selects manual sync`() { assertEquals( false, backgroundSyncChoice( BackgroundSyncAction.MANUAL_ONLY, notificationsAvailable = true, ), ) } @Test fun `primary action selects background sync only with a visible notification`() { assertEquals( true, backgroundSyncChoice( BackgroundSyncAction.ALLOW, notificationsAvailable = true, ), ) assertEquals( false, backgroundSyncChoice( BackgroundSyncAction.ALLOW, notificationsAvailable = false, ), ) } @Test fun `dismissal cannot silently enable background sync without notifications`() { assertEquals( false, backgroundSyncChoice( BackgroundSyncAction.DISMISS, notificationsAvailable = false, ), ) } }