aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/com
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/com')
-rw-r--r--src/test/java/com/juick/server/tests/ServerTests.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/test/java/com/juick/server/tests/ServerTests.java b/src/test/java/com/juick/server/tests/ServerTests.java
index 87617cea..da777a92 100644
--- a/src/test/java/com/juick/server/tests/ServerTests.java
+++ b/src/test/java/com/juick/server/tests/ServerTests.java
@@ -213,6 +213,7 @@ import org.springframework.test.web.client.MockRestServiceServer;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.MvcResult;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
+import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.DigestUtils;
import org.springframework.util.FileSystemUtils;
import org.springframework.util.LinkedMultiValueMap;
@@ -1025,6 +1026,7 @@ public class ServerTests {
}
@Test
+ @Transactional
public void recommendTests() throws Exception {
int mid = messagesService.createMessage(ugnich.getUid(), "to be liked", null, Set.of());
@@ -1037,6 +1039,13 @@ public class ServerTests {
.andExpect(jsonPath("$[0].recommendations.length()", is(1)))
.andExpect(jsonPath("$[0].recommendations[0].uname", is(freefdName)));
mockMvc.perform(post("/api/like?mid=" + freefdMid + "&hash=" + freefdHash)).andExpect(status().isForbidden());
+ messagesService.createReply(mid, 0, freefd, "reply", null);
+ mockMvc.perform(get("/api/thread?mid=" + mid + "&hash=" + freefdHash)).andExpect(status().isOk())
+ .andExpect(jsonPath("$.length()", is(2)))
+ .andExpect(jsonPath("$[0].replies", is(1)));
+ mockMvc.perform(get("/api/thread?mid=" + mid + "&hash=" + freefdHash + "&showReplies=false")).andExpect(status().isOk())
+ .andExpect(jsonPath("$.length()", is(1)))
+ .andExpect(jsonPath("$[0].replies", is(1)));
}
@Test