diff --git a/mydreamjob-server/src/test/java/com/mydreamjob/careerprogress/CareerProgressControllerTest.java b/mydreamjob-server/src/test/java/com/mydreamjob/careerprogress/CareerProgressControllerTest.java index c750f5e..815c34e 100644 --- a/mydreamjob-server/src/test/java/com/mydreamjob/careerprogress/CareerProgressControllerTest.java +++ b/mydreamjob-server/src/test/java/com/mydreamjob/careerprogress/CareerProgressControllerTest.java @@ -249,6 +249,10 @@ class CareerProgressControllerTest { .andExpect(jsonPath("$.data.applications.items").isArray()) .andExpect(jsonPath("$.data.applications.items.length()").value(0)) .andExpect(jsonPath("$.data.applications.total").value(0)) + .andExpect(jsonPath("$.data.applications.page").value(0)) + .andExpect(jsonPath("$.data.applications.size").value(20)) + .andExpect(jsonPath("$.data.applications.totalPages").value(0)) + .andExpect(jsonPath("$.data.generatedAt").isString()) .andExpect(jsonPath("$.data.todo.pendingInterviewResponseCount").value(0)) .andExpect(jsonPath("$.data.todo.upcomingConfirmedInterviewCount").value(0)) .andExpect(jsonPath("$.data.todo.pendingOfferResponseCount").value(0)) @@ -258,6 +262,50 @@ class CareerProgressControllerTest { // ── 正常聚合 + 脱敏 + 通知仅计数 ──────────────────────────── + @Test + void beyondLastPage_keepsMatchingTotal_andIndependentTodo() throws Exception { + mockMvc.perform(get("/profile/me/career-progress").param("page", "2").param("size", "1") + .header("Authorization", token(me))) + .andExpect(status().isOk()) + .andExpect(jsonPath("$.data.applications.items").isArray()) + .andExpect(jsonPath("$.data.applications.items.length()").value(0)) + .andExpect(jsonPath("$.data.applications.total").value(1)) + .andExpect(jsonPath("$.data.applications.page").value(2)) + .andExpect(jsonPath("$.data.applications.size").value(1)) + .andExpect(jsonPath("$.data.applications.totalPages").value(1)) + .andExpect(jsonPath("$.data.todo.pendingInterviewResponseCount").value(1)) + .andExpect(jsonPath("$.data.todo.pendingOfferResponseCount").value(1)) + .andExpect(jsonPath("$.data.generatedAt").isString()); + } + + @Test + void statusFilter_changesApplicationTotal_notTodoCounts() throws Exception { + mockMvc.perform(get("/profile/me/career-progress").param("status", "SUBMITTED") + .header("Authorization", token(me))) + .andExpect(status().isOk()) + // rival 的 SUBMITTED 不能混入本人的结果;todo 不受投递列表筛选影响。 + .andExpect(jsonPath("$.data.applications.items").isArray()) + .andExpect(jsonPath("$.data.applications.items.length()").value(0)) + .andExpect(jsonPath("$.data.applications.total").value(0)) + .andExpect(jsonPath("$.data.applications.totalPages").value(0)) + .andExpect(jsonPath("$.data.todo.pendingInterviewResponseCount").value(1)) + .andExpect(jsonPath("$.data.todo.pendingOfferResponseCount").value(1)); + } + + @Test + void absentOptionalSummaries_areOmitted_notPlaceholderObjects() throws Exception { + mockMvc.perform(get("/profile/me/career-progress") + .header("Authorization", token(rival))) + .andExpect(status().isOk()) + .andExpect(jsonPath("$.data.applications.items.length()").value(1)) + .andExpect(jsonPath("$.data.applications.items[0].applicationStatus").value("SUBMITTED")) + .andExpect(jsonPath("$.data.applications.items[0].nextInterview").doesNotExist()) + .andExpect(jsonPath("$.data.applications.items[0].offer").doesNotExist()) + .andExpect(jsonPath("$.data.applications.items[0].latestSubmittedInterviewScore").doesNotExist()) + .andExpect(jsonPath("$.data.todo.pendingInterviewResponseCount").value(0)) + .andExpect(jsonPath("$.data.todo.pendingOfferResponseCount").value(0)); + } + @Test void studentReturnsAggregatedResult_andDesensitized() throws Exception { mockMvc.perform(get("/profile/me/career-progress") @@ -314,4 +362,4 @@ class CareerProgressControllerTest { .andExpect(jsonPath("$.data.notifications").doesNotExist()) .andExpect(jsonPath("$.data.notificationTitle").doesNotExist()); } -} \ No newline at end of file +}