package com.ponzischeme89.memby.ui

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

class HomeGreetingTest {
    @Test
    fun `time of day selects the expected greeting`() {
        assertEquals(HomeGreetingPeriod.EVENING, homeGreetingPeriod(4))
        assertEquals(HomeGreetingPeriod.MORNING, homeGreetingPeriod(5))
        assertEquals(HomeGreetingPeriod.MORNING, homeGreetingPeriod(11))
        assertEquals(HomeGreetingPeriod.AFTERNOON, homeGreetingPeriod(12))
        assertEquals(HomeGreetingPeriod.AFTERNOON, homeGreetingPeriod(16))
        assertEquals(HomeGreetingPeriod.EVENING, homeGreetingPeriod(17))
    }

    @Test
    fun `greeting is shown after hero through continue watching`() {
        val rows = listOf("featured", "continue", "latest")

        assertTrue(shouldShowHomeGreeting(true, "featured", rows))
        assertTrue(shouldShowHomeGreeting(true, "continue", rows))
        assertFalse(shouldShowHomeGreeting(true, "latest", rows))
        assertFalse(shouldShowHomeGreeting(true, null, rows))
        assertFalse(shouldShowHomeGreeting(false, "continue", rows))
    }
}
