Просмотр исходного кода

test: 增强 ControllerIntegrationTest 断言

testProfileInfo 增加 avatarUrl 字段校验,testAdminConfig_withUserToken_rejected 增加 message 校验,testChartDelete_ownRecord 增加 verify 调用校验。

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
liaoxg 5 месяцев назад
Родитель
Сommit
5908a6fc47

+ 6 - 2
num-server/src/test/java/com/etotem/num/controller/ControllerIntegrationTest.java

@@ -231,6 +231,8 @@ class ControllerIntegrationTest {
                         .content("{\"id\":5}"))
                 .andExpect(status().isOk())
                 .andExpect(jsonPath("$.code").value(0));
+
+        verify(chartService).deleteChart(5L, 100L);
     }
 
     @Test
@@ -392,7 +394,8 @@ class ControllerIntegrationTest {
                         .header("Authorization", "Bearer " + userToken)
                         .contentType(MediaType.APPLICATION_JSON))
                 .andExpect(status().isOk())
-                .andExpect(jsonPath("$.code").value(1001));
+                .andExpect(jsonPath("$.code").value(1001))
+                .andExpect(jsonPath("$.message").value("Admin access required"));
     }
 
     // ==================== Error Handling ====================
@@ -424,7 +427,8 @@ class ControllerIntegrationTest {
                         .header("Authorization", "Bearer " + userToken))
                 .andExpect(status().isOk())
                 .andExpect(jsonPath("$.code").value(0))
-                .andExpect(jsonPath("$.data.nickname").value("测试用户"));
+                .andExpect(jsonPath("$.data.nickname").value("测试用户"))
+                .andExpect(jsonPath("$.data.avatarUrl").value("http://avatar.url"));
     }
 
     @Test