Add more tests for new page
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 24 May 2017 17:39:38 +0000 (19:39 +0200)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 24 May 2017 17:39:38 +0000 (19:39 +0200)
src/test/kotlin/net/pterodactylus/sone/web/pages/NewPageTest.kt

index 72d87f8..62b1baa 100644 (file)
@@ -7,6 +7,7 @@ import net.pterodactylus.sone.test.mock
 import net.pterodactylus.sone.test.whenever
 import org.hamcrest.MatcherAssert.assertThat
 import org.hamcrest.Matchers.containsInAnyOrder
+import org.hamcrest.Matchers.equalTo
 import org.junit.Before
 import org.junit.Test
 import java.util.Arrays.asList
@@ -26,6 +27,22 @@ class NewPageTest: WebPageTest() {
        }
 
        @Test
+       fun `page returns correct path`() {
+               assertThat(page.path, equalTo("new.html"))
+       }
+
+       @Test
+       fun `page does not require login`() {
+               assertThat(page.requiresLogin(), equalTo(false))
+       }
+
+       @Test
+       fun `page returns correct title`() {
+               addTranslation("Page.New.Title", "new page title")
+               assertThat(page.getPageTitle(freenetRequest), equalTo("new page title"))
+       }
+
+       @Test
        fun `posts are not duplicated when they come from both new posts and new replies notifications`() {
                val extraPost = mock<Post>()
                val posts = asList(mock<Post>(), mock<Post>())