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.java25
1 files changed, 25 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 a509b36d..5c421f07 100644
--- a/src/test/java/com/juick/server/tests/ServerTests.java
+++ b/src/test/java/com/juick/server/tests/ServerTests.java
@@ -19,6 +19,7 @@ package com.juick.server.tests;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.gargoylesoftware.htmlunit.CookieManager;
import com.gargoylesoftware.htmlunit.WebClient;
@@ -1961,4 +1962,28 @@ public class ServerTests {
Follow follow = jsonMapper.readValue(followData, Follow.class);
assertThat(follow.getActor(), is("https://ussr.win/channel/zlax"));
}
+ @Test
+ public void nodeinfo() throws Exception {
+ MvcResult nodeinfoXRD = mockMvc.perform(get("/.well-known/nodeinfo")
+ .contentType(MediaType.APPLICATION_JSON))
+ .andExpect(status().isOk())
+ .andReturn();
+ JsonNode node = jsonMapper.readTree(nodeinfoXRD.getResponse().getContentAsString());
+ assertThat(node.get("links"), notNullValue());
+ String nodeinfoUrl = node.get("links").get(0).get("href").textValue();
+ MvcResult nodeinfoData = mockMvc.perform(get(nodeinfoUrl)
+ .contentType(MediaType.APPLICATION_JSON))
+ .andExpect(status().isOk())
+ .andReturn();
+ JsonNode nodeinfo = jsonMapper.readTree(nodeinfoData.getResponse().getContentAsString());
+ assertThat(nodeinfo.get("software"), notNullValue());
+ assertThat(nodeinfo.get("server"), nullValue());
+ MvcResult xnodeinfoData = mockMvc.perform(get("/.well-known/x-nodeinfo2")
+ .contentType(MediaType.APPLICATION_JSON))
+ .andExpect(status().isOk())
+ .andReturn();
+ JsonNode xnodeinfo = jsonMapper.readTree(xnodeinfoData.getResponse().getContentAsString());
+ assertThat(xnodeinfo.get("server"), notNullValue());
+ assertThat(xnodeinfo.get("software"), nullValue());
+ }
}