/**
* Unit test for [ViewSonePage].
*/
-class ViewSonePageTest : WebPageTest() {
+class ViewSonePageTest: WebPageTest() {
init {
whenever(currentSone.id).thenReturn("sone-id")
}
@Test
+ fun `page returns correct path`() {
+ assertThat(page.path, equalTo("viewSone.html"))
+ }
+
+ @Test
+ fun `page does not require login`() {
+ assertThat(page.requiresLogin(), equalTo(false))
+ }
+
+ @Test
fun `get request without sone parameter stores null in template context`() {
verifyNoRedirect {
assertThat(templateContext["sone"], nullValue())
@Test
fun `page title is default for request without parameters`() {
- assertThat(page.getPageTitle(freenetRequest), equalTo("Page.ViewSone.Page.TitleWithoutSone"))
+ addTranslation("Page.ViewSone.Page.TitleWithoutSone", "view sone page without sone")
+ assertThat(page.getPageTitle(freenetRequest), equalTo("view sone page without sone"))
}
@Test
fun `page title is default for request with invalid sone parameters`() {
addHttpRequestParameter("sone", "invalid-sone-id")
- assertThat(page.getPageTitle(freenetRequest), equalTo("Page.ViewSone.Page.TitleWithoutSone"))
+ addTranslation("Page.ViewSone.Page.TitleWithoutSone", "view sone page without sone")
+ assertThat(page.getPageTitle(freenetRequest), equalTo("view sone page without sone"))
}
@Test
middleName = "M."
lastName = "Last"
})
- assertThat(page.getPageTitle(freenetRequest), equalTo("First M. Last - Page.ViewSone.Title"))
+ addTranslation("Page.ViewSone.Title", "view sone page")
+ assertThat(page.getPageTitle(freenetRequest), equalTo("First M. Last - view sone page"))
}
@Test