package solutions.tretter.mindmachine.session

import org.junit.Assert.assertEquals
import org.junit.Test

class DurationFormatTest {
    @Test
    fun `duration up to 60 minutes is shown in whole minutes only`() {
        assertEquals("1 min", formatDuration(60))
        assertEquals("45 min", formatDuration(45 * 60 + 59))
        assertEquals("60 min", formatDuration(60 * 60))
    }

    @Test
    fun `duration over 60 minutes is shown in hours with at most two decimals`() {
        assertEquals("1.02 h", formatDuration(61 * 60))
        assertEquals("1.5 h", formatDuration(90 * 60))
        assertEquals("2 h", formatDuration(120 * 60))
    }
}
