项目类型新增机械臂
This commit is contained in:
@@ -42,6 +42,7 @@ community:
|
||||
HUMANOID: 人形
|
||||
QUADRUPED: 四足
|
||||
WHEELED: 轮式
|
||||
ROBOTIC_ARM: 机械臂
|
||||
captcha-ttl: 2m
|
||||
token-ttl: 24h
|
||||
max-text-bytes: 1048576
|
||||
|
||||
@@ -186,7 +186,7 @@ class AiSearchTest {
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ValueSource(strings = {"GENERAL", "HUMANOID", "QUADRUPED", "WHEELED"})
|
||||
@ValueSource(strings = {"GENERAL", "HUMANOID", "QUADRUPED", "WHEELED", "ROBOTIC_ARM"})
|
||||
void filtersConfiguredTypesAndKeepsProjectContract(String type) throws Exception {
|
||||
Project expected = project("教学机器人", type, "支持 ROS2 教学");
|
||||
expected.setCoverUrl("https://images.example.com/robot.png");
|
||||
|
||||
@@ -171,6 +171,33 @@ class WorkflowTest {
|
||||
200);
|
||||
}
|
||||
|
||||
@Test
|
||||
void roboticArmTypeSupportsDiscoveryCreationEditingAndCommunityFiltering() throws Exception {
|
||||
JsonNode types = perform(get("/api/project-types"), 200).path("data");
|
||||
assertThat(types.findValuesAsText("code")).contains("ROBOTIC_ARM");
|
||||
for (JsonNode type : types) {
|
||||
if (type.path("code").asText().equals("ROBOTIC_ARM"))
|
||||
assertThat(type.path("name").asText()).isEqualTo("机械臂");
|
||||
}
|
||||
String owner = login("arm-owner@example.com");
|
||||
JsonNode arm = perform(body(auth(post("/api/workspace/projects"), owner),
|
||||
Map.of("name", "机械臂项目", "projectType", "ROBOTIC_ARM")), 200).path("data");
|
||||
String armCode = arm.path("projectCode").asText();
|
||||
assertThat(arm.path("projectType").asText()).isEqualTo("ROBOTIC_ARM");
|
||||
publish(owner, armCode, head(owner, armCode));
|
||||
String generalCode = create(owner, "待分类项目");
|
||||
publish(owner, generalCode, head(owner, generalCode));
|
||||
JsonNode filtered = perform(get("/api/community/projects").param("type", "ROBOTIC_ARM"), 200)
|
||||
.path("data").path("items");
|
||||
assertThat(filtered.size()).isEqualTo(1);
|
||||
assertThat(filtered.get(0).path("projectCode").asText()).isEqualTo(armCode);
|
||||
JsonNode edited = perform(body(auth(patch("/api/workspace/projects/" + generalCode), owner),
|
||||
Map.of("name", "已分类项目", "projectType", "ROBOTIC_ARM")), 200).path("data");
|
||||
assertThat(edited.path("projectType").asText()).isEqualTo("ROBOTIC_ARM");
|
||||
assertThat(perform(get("/api/community/projects").param("type", "ROBOTIC_ARM"), 200)
|
||||
.path("data").path("items").size()).isEqualTo(2);
|
||||
}
|
||||
|
||||
@Test
|
||||
void shortProjectsAndLegacyProjectsRemainUsableTogether() throws Exception {
|
||||
String owner = login("short-owner@example.com");
|
||||
|
||||
Reference in New Issue
Block a user