From: David ‘Bombe’ Roden Date: Fri, 5 May 2017 21:22:02 +0000 (+0200) Subject: Add more tests for the known Sones page X-Git-Tag: 0.9.7^2~221 X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=301bb7b8da8514c6cb656160d87a612527b9f70b;p=Sone.git Add more tests for the known Sones page --- diff --git a/src/test/kotlin/net/pterodactylus/sone/web/pages/KnownSonesPageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/pages/KnownSonesPageTest.kt index 0476c50..3b304e3 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/pages/KnownSonesPageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/pages/KnownSonesPageTest.kt @@ -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)