1 package net.pterodactylus.sone.web.ajax
3 import net.pterodactylus.sone.test.getInstance
4 import net.pterodactylus.sone.web.baseInjector
5 import org.hamcrest.MatcherAssert.assertThat
6 import org.hamcrest.Matchers.equalTo
7 import org.hamcrest.Matchers.notNullValue
11 * Unit test for [GetTranslationAjaxPage].
13 class GetTranslationAjaxPageTest : JsonPageTest("getTranslation.ajax", requiresLogin = false, needsFormPassword = false, pageSupplier = ::GetTranslationAjaxPage) {
16 fun `translation is returned correctly`() {
17 addTranslation("foo", "bar")
18 addRequestParameter("key", "foo")
19 assertThatJsonIsSuccessful()
20 assertThat(json["value"]?.asText(), equalTo("bar"))
24 fun `page can be created by dependency injection`() {
25 assertThat(baseInjector.getInstance<GetTranslationAjaxPage>(), notNullValue())