From e0225bc87f36161090e1954cefd6611e0f534a8a Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sat, 12 Aug 2023 02:22:36 +0300 Subject: X: add JSON root endpoint --- src/test/java/com/juick/server/tests/ServerTests.java | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/test/java/com/juick') diff --git a/src/test/java/com/juick/server/tests/ServerTests.java b/src/test/java/com/juick/server/tests/ServerTests.java index ce9b49d0..5a32c9ef 100644 --- a/src/test/java/com/juick/server/tests/ServerTests.java +++ b/src/test/java/com/juick/server/tests/ServerTests.java @@ -2534,6 +2534,16 @@ public class ServerTests { mockMvc.perform(get(htmlUri)).andExpect(status().isOk()); mockMvc.perform(get(ldUri)).andExpect(status().isOk()); } + @Test + public void jsonRequestToRootShouldRespondWithJsonContent() throws Exception { + var jsonHeader = "application/json"; + mockMvc.perform(get("/").accept(jsonHeader)) + .andExpect(status().isOk()) + .andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE)); + HtmlPage htmlPage = webClient.getPage("/"); + assertThat(htmlPage.isHtmlPage(), is(true)); + assertThat(htmlPage.getTitleText(), is("Discuss")); + } @Test @Transactional -- cgit v1.2.3