X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Ftest%2Fkotlin%2Fnet%2Fpterodactylus%2Fsone%2Fweb%2Fajax%2FBookmarkAjaxPageTest.kt;h=17c334e2cc2fb4b6f4f1bf939597fda1ee3745aa;hp=7e72e568a96379c6fbb4f463837d520a9e187578;hb=43278c5468221baa16946a5206c3a4e97d543010;hpb=d58ef344b43543fdcfca13c07df87e194f004376 diff --git a/src/test/kotlin/net/pterodactylus/sone/web/ajax/BookmarkAjaxPageTest.kt b/src/test/kotlin/net/pterodactylus/sone/web/ajax/BookmarkAjaxPageTest.kt index 7e72e56..17c334e 100644 --- a/src/test/kotlin/net/pterodactylus/sone/web/ajax/BookmarkAjaxPageTest.kt +++ b/src/test/kotlin/net/pterodactylus/sone/web/ajax/BookmarkAjaxPageTest.kt @@ -15,21 +15,19 @@ class BookmarkAjaxPageTest : JsonPageTest("bookmark.ajax", requiresLogin = false @Test fun `missing post ID results in invalid id response`() { - assertThat(json.isSuccess, equalTo(false)) - assertThat(json.error, equalTo("invalid-post-id")) + assertThatJsonFailed("invalid-post-id") } @Test fun `empty post ID results in invalid id response`() { addRequestParameter("post", "") - assertThat(json.isSuccess, equalTo(false)) - assertThat(json.error, equalTo("invalid-post-id")) + assertThatJsonFailed("invalid-post-id") } @Test fun `invalid post ID results in success but does not bookmark anything`() { addRequestParameter("post", "missing") - assertThat(json.isSuccess, equalTo(true)) + assertThatJsonIsSuccessful() verify(core, never()).bookmarkPost(any()) } @@ -37,7 +35,7 @@ class BookmarkAjaxPageTest : JsonPageTest("bookmark.ajax", requiresLogin = false fun `valid post ID results in success and bookmarks the post`() { addRequestParameter("post", "valid-post-id") val post = addNewPost("valid-post-id", "1", 2) - assertThat(json.isSuccess, equalTo(true)) + assertThatJsonIsSuccessful() verify(core).bookmarkPost(post) }