package wang.yaojia.webterm.components

import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Assertions.assertNull
import org.junit.jupiter.api.Test

/**
 * The [continueLastModel] derivation (plan §5 A29 Verify): the banner is shown IFF a last session exists.
 * A non-blank persisted id yields a [ContinueLastModel]; `null`/blank yields `null` (banner hidden). The
 * composable's "render nothing on null" branch + layout are device-QA (plan §7); this is the JVM core.
 */
class ContinueLastBannerTest {

    @Test
    fun `a persisted last session id yields a shown banner model`() {
        assertEquals(ContinueLastModel("sess-9"), continueLastModel("sess-9"))
    }

    @Test
    fun `no last session id yields no banner`() {
        assertNull(continueLastModel(null))
    }

    @Test
    fun `a blank id is treated as no last session`() {
        assertNull(continueLastModel("   "))
    }
}
