package pl.firmatpp.kierowca.sync

import org.junit.After
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Test

class DriverRuntimeSyncStateTest {
    @After
    fun reset() {
        DriverRuntimeSyncState.foreground = false
        DriverRuntimeSyncState.realtimeConnected = false
    }

    @Test
    fun websocketSuppressesDuplicateFcmSyncOnlyWhenForegroundAndConnected() {
        DriverRuntimeSyncState.foreground = true
        DriverRuntimeSyncState.realtimeConnected = true
        assertTrue(DriverRuntimeSyncState.websocketOwnsForegroundHints())

        DriverRuntimeSyncState.realtimeConnected = false
        assertFalse(DriverRuntimeSyncState.websocketOwnsForegroundHints())
    }
}
