X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Ftest%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2FWebInterfaceModuleTest.kt;fp=src%2Ftest%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2FWebInterfaceModuleTest.kt;h=14427ef2c420d439b562f4eb69c662e8c928d6c3;hp=ec09b201d0fd415e14e91ba10c727cae2e44fbd0;hb=d50730f6a330439e0e7ef97ca9329dffe72d5640;hpb=97fe04482ebb8a08e43294acde041c2975cbd8ee diff --git a/src/test/kotlin/net/pterodactylus/sone/web/WebInterfaceModuleTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/WebInterfaceModuleTest.kt index ec09b20..14427ef 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/WebInterfaceModuleTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/WebInterfaceModuleTest.kt @@ -20,17 +20,21 @@ import net.pterodactylus.util.web.* import org.hamcrest.MatcherAssert.* import org.hamcrest.Matchers.* import org.junit.* +import java.util.* import kotlin.test.Test class WebInterfaceModuleTest { private val webInterfaceModule = WebInterfaceModule() - private val l10n = mock() private val loaders = mock() + private val translation = object : Translation { + override val currentLocale = Locale.ENGLISH + override fun translate(key: String) = if (key == "View.Sone.Text.UnknownDate") "unknown" else key + } private val additionalModules = arrayOf( Core::class.isProvidedByMock(), SoneProvider::class.isProvidedByMock(), - BaseL10n::class.isProvidedBy(l10n), + Translation::class.isProvidedBy(translation), SoneTextParser::class.isProvidedByMock(), ElementLoader::class.isProvidedByMock(), Loaders::class.isProvidedBy(loaders), @@ -191,7 +195,6 @@ class WebInterfaceModuleTest { @Test fun `unknown date filter uses correct l10n key`() { - whenever(l10n.getString("View.Sone.Text.UnknownDate")).thenReturn("unknown") assertThat(getFilter("unknown")!!.format(null, 0L, emptyMap()), equalTo("unknown")) } @@ -240,6 +243,11 @@ class WebInterfaceModuleTest { verifyFilter("paginate") } + @Test + fun `template context histogram renderer`() { + verifyFilter("render-histogram") + } + private inline fun verifyFilter(name: String) { assertThat(getFilter(name), instanceOf(F::class.java)) }