package com.dano.test1.questionnaire

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

class SpinnerSelectionHelperTest {

    @Test
    fun indexForSavedValue_matchesLiteralOption() {
        val items = listOf("Choose", "Germany", "France")
        val index = SpinnerSelectionHelper.indexForSavedValue(
            "ENGLISH",
            items,
            "Germany",
            listOf("Germany", "France"),
        )
        assertEquals(1, index)
    }

    @Test
    fun indexForSavedValue_matchesCaseInsensitive() {
        val items = listOf("Choose", "Germany", "France")
        val index = SpinnerSelectionHelper.indexForSavedValue(
            "ENGLISH",
            items,
            "france",
            listOf("Germany", "France"),
        )
        assertEquals(2, index)
    }
}
