package com.github.nullptroma.wallenc.ui.resources

import com.github.nullptroma.wallenc.domain.tasks.TaskProgressLabel
import com.github.nullptroma.wallenc.domain.tasks.VaultTaskStep
import com.github.nullptroma.wallenc.ui.R
import org.junit.Assert.assertEquals
import org.junit.Test

class TaskProgressLabelsTest {

    private val resolver = object : UiStringResolver {
        override fun invoke(id: Int, vararg formatArgs: Any): String = "res:$id"

        override fun plurals(id: Int, quantity: Int, vararg formatArgs: Any): String = "plural:$id"
    }

    @Test
    fun syncNoGroups_mapsToStringRes() {
        val text = TaskProgressLabel.SyncNoGroups.resolve(resolver)
        assertEquals("res:${R.string.sync_progress_no_groups}", text)
    }

    @Test
    fun vaultTask_mapsToStringRes() {
        val text = TaskProgressLabel.VaultTask(VaultTaskStep.Save2FaToken).resolve(resolver)
        assertEquals("res:${R.string.task_progress_save_2fa_token}", text)
    }

    @Test
    fun clearContentProgress_mapsToStringRes() {
        val text = TaskProgressLabel.ClearContentProgress(3, 10).resolve(resolver)
        assertEquals("res:${R.string.task_progress_clear_content}", text)
    }
}
