Add more tests for the known Sones page
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 5 May 2017 21:22:02 +0000 (23:22 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Fri, 5 May 2017 21:22:02 +0000 (23:22 +0200)
src/test/kotlin/net/pterodactylus/sone/web/pages/KnownSonesPageTest.kt

index 0476c50..3b304e3 100644 (file)
@@ -14,6 +14,7 @@ import net.pterodactylus.sone.web.pages.KnownSonesPage
 import net.pterodactylus.sone.web.pages.WebPageTest
 import org.hamcrest.MatcherAssert.assertThat
 import org.hamcrest.Matchers.contains
+import org.hamcrest.Matchers.equalTo
 import org.junit.Before
 import org.junit.Test
 
@@ -64,6 +65,22 @@ class KnownSonesPageTest : WebPageTest() {
        }
 
        @Test
+       fun `page returns correct path`() {
+           assertThat(page.path, equalTo("knownSones.html"))
+       }
+
+       @Test
+       fun `page does not require login`() {
+           assertThat(page.requiresLogin(), equalTo(false))
+       }
+
+       @Test
+       fun `page returns correct title`() {
+               whenever(l10n.getString("Page.KnownSones.Title")).thenReturn("known sones page title")
+           assertThat(page.getPageTitle(freenetRequest), equalTo("known sones page title"))
+       }
+
+       @Test
        fun `default known sones are sorted newest first`() {
                page.handleRequest(freenetRequest, templateContext)
                verifySonesAreInOrder(3, 2, 1, 0)