package com.fabledsword.minstrel.shared

import org.junit.jupiter.api.Test
import kotlin.test.assertEquals

class FormattingTest {
    @Test
    fun `formatDuration formats minutes and seconds`() {
        assertEquals("0:05", formatDuration(5))
        assertEquals("2:05", formatDuration(125))
        assertEquals("10:00", formatDuration(600))
    }

    @Test
    fun `formatDuration uses the zero string for non-positive input`() {
        assertEquals("0:00", formatDuration(0))
        assertEquals("0:00", formatDuration(-3))
        assertEquals("--:--", formatDuration(0, zero = "--:--"))
    }

    @Test
    fun `conversions round-trip seconds and millis`() {
        assertEquals(5000, 5.secondsToMillis())
        assertEquals(5, 5000.millisToSeconds())
        assertEquals(5, 5000L.millisToSeconds())
    }
}
