refactor(工作台): 测试计划为空返回空数据
This commit is contained in:
parent
9e06b36f6f
commit
95eedaa556
|
@ -718,6 +718,9 @@ public class DashboardService {
|
|||
if (Boolean.FALSE.equals(permissionCheckService.checkModule(projectId, TEST_PLAN_MODULE, currentUserId, PermissionConstants.TEST_PLAN_READ))) {
|
||||
overViewCountDTO.setErrorCode(NO_PROJECT_PERMISSION.getCode());
|
||||
}
|
||||
if (StringUtils.isBlank(request.getPlanId())) {
|
||||
return new OverViewCountDTO(new HashMap<>(), new ArrayList<>(), new ArrayList<>(), 0);
|
||||
}
|
||||
List<String> planIds = List.of(request.getPlanId());
|
||||
List<TestPlanStatisticsResponse> testPlanStatisticsResponses = planStatisticsService.calculateRate(planIds);
|
||||
TestPlanStatisticsResponse planCount = testPlanStatisticsResponses.getFirst();
|
||||
|
|
|
@ -178,6 +178,12 @@ public class DashboardFrontPageControllerTests extends BaseTest {
|
|||
OverViewCountDTO.class);
|
||||
Assertions.assertNotNull(moduleCountAll);
|
||||
|
||||
mvcResultAll = this.requestPostWithOkAndReturn(PROJECT_PLAN_VIEW, dashboardFrontPageRequest);
|
||||
moduleCountAll = JSON.parseObject(JSON.toJSONString(
|
||||
JSON.parseObject(mvcResultAll.getResponse().getContentAsString(StandardCharsets.UTF_8), ResultHolder.class).getData()),
|
||||
OverViewCountDTO.class);
|
||||
Assertions.assertNotNull(moduleCountAll);
|
||||
|
||||
dashboardFrontPageRequest.setPlanId("dashboard_test-plan-id");
|
||||
mvcResultAll = this.requestPostWithOkAndReturn(PROJECT_PLAN_VIEW, dashboardFrontPageRequest);
|
||||
moduleCountAll = JSON.parseObject(JSON.toJSONString(
|
||||
|
|
Loading…
Reference in New Issue