🔀 Merge branch 'release/v82'
[Sone.git] / ajax / GetTranslationAjaxPageTest.kt
1 package net.pterodactylus.sone.web.ajax
2
3 import org.hamcrest.MatcherAssert.assertThat
4 import org.hamcrest.Matchers.equalTo
5 import org.junit.Test
6
7 /**
8  * Unit test for [GetTranslationAjaxPage].
9  */
10 class GetTranslationAjaxPageTest : JsonPageTest("getTranslation.ajax", requiresLogin = false, needsFormPassword = false, pageSupplier = ::GetTranslationAjaxPage) {
11
12         @Test
13         fun `translation is returned correctly`() {
14                 addTranslation("foo", "bar")
15                 addRequestParameter("key", "foo")
16                 assertThatJsonIsSuccessful()
17                 assertThat(json["value"]?.asText(), equalTo("bar"))
18         }
19
20 }