diff options
author | Vitaly Takmazov | 2022-10-04 21:45:26 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2022-10-04 21:45:26 +0300 |
commit | 21927063ea989551613ae35ab4b71c9e880db0a1 (patch) | |
tree | 07c32ae12be0e929ee9570e4eaff13614e376c5b /src/test/java/com/juick/server | |
parent | 8ec8241b63ae6b59e3d4a17bd7feb11723820eac (diff) |
Always include empty pms list in `groups_pms` API response
Diffstat (limited to 'src/test/java/com/juick/server')
-rw-r--r-- | src/test/java/com/juick/server/tests/ServerTests.java | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/test/java/com/juick/server/tests/ServerTests.java b/src/test/java/com/juick/server/tests/ServerTests.java index 0971f6b1..87617cea 100644 --- a/src/test/java/com/juick/server/tests/ServerTests.java +++ b/src/test/java/com/juick/server/tests/ServerTests.java @@ -32,6 +32,7 @@ import static org.hamcrest.Matchers.lessThan; import static org.hamcrest.Matchers.notNullValue; import static org.hamcrest.Matchers.nullValue; import static org.hamcrest.Matchers.startsWith; +import static org.hamcrest.collection.IsEmptyCollection.empty; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertThrows; @@ -2511,7 +2512,8 @@ public class ServerTests { @Test public void invalidMediaTypeTest() throws Exception { - mockMvc.perform(get("/api/messages").header("Accept", "application/xml")).andExpect(status().isBadRequest()) + mockMvc.perform(get("/api/messages") + .header("Accept", "application/xml")).andExpect(status().isBadRequest()) .andExpect(content().string("Invalid media type")); } @@ -2521,4 +2523,14 @@ public class ServerTests { String contextString = jsonMapper.writeValueAsString(context); assertThat(contextString, is("{\"id\":\"http://juick.com/u/ermine\"}")); } + + @Test + public void emptyListForEmptyChatsList() throws Exception { + jdbcTemplate.execute("DELETE FROM pm"); + mockMvc.perform( + get("/api/groups_pms").with(httpBasic(ugnichName, ugnichPassword))) + .andExpect(status().isOk()) + .andExpect(jsonPath("$.pms", empty())); + + } } |