1 package net.pterodactylus.sone.web.ajax
3 import net.pterodactylus.sone.test.mock
4 import org.hamcrest.MatcherAssert.assertThat
5 import org.hamcrest.Matchers.equalTo
7 import org.mockito.Mockito.verify
10 * Unit test for [UnfollowSoneAjaxPage].
12 class UnfollowSoneAjaxPageTest : JsonPageTest("unfollowSone.ajax", pageSupplier = ::UnfollowSoneAjaxPage) {
15 fun `request without sone returns invalid-sone-id`() {
16 assertThatJsonFailed("invalid-sone-id")
20 fun `request with invalid sone returns invalid-sone-id`() {
21 addRequestParameter("sone", "invalid")
22 assertThatJsonFailed("invalid-sone-id")
26 fun `request with valid sone unfollows sone`() {
27 addSone(mock(), "sone-id")
28 addRequestParameter("sone", "sone-id")
29 assertThatJsonIsSuccessful()
30 verify(core).unfollowSone(currentSone, "sone-id")