Skip to content

Commit 5ca687f

Browse files
committed
Add more tests
1 parent a48db06 commit 5ca687f

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

src/test/kotlin/com/katalisindonesia/banyuwangi/controller/AlarmControllerTest.kt

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,51 @@ class AlarmControllerTest(
5656
}
5757
}
5858

59+
@Test
60+
fun `list and count empty with parameters`() {
61+
mockMvc.get(
62+
"/v1/alarm/list?beginning=2022-01-01" +
63+
"&ending=2022-01-02&detectionType=TRASH"
64+
) {
65+
headers {
66+
setBearerAuth(token())
67+
accept = listOf(MediaType.APPLICATION_JSON)
68+
}
69+
}.andExpect {
70+
status { isOk() }
71+
content {
72+
json(
73+
"""{
74+
"success": true,
75+
"message": "ok",
76+
"data": []
77+
}""",
78+
strict = false,
79+
)
80+
}
81+
}
82+
mockMvc.get(
83+
"/v1/alarm/count?beginning=2022-01-01" +
84+
"&ending=2022-01-02&detectionType=TRASH"
85+
) {
86+
headers {
87+
setBearerAuth(token())
88+
accept = listOf(MediaType.APPLICATION_JSON)
89+
}
90+
}.andExpect {
91+
status { isOk() }
92+
content {
93+
json(
94+
"""{
95+
"success": true,
96+
"message": "ok",
97+
"data": 0
98+
}""",
99+
strict = false,
100+
)
101+
}
102+
}
103+
}
104+
59105
private fun token(): String = tokenManager.accessToken("banyuwangi-test", "banyuwangi-test")
60106
}

0 commit comments

Comments
 (0)