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

更新测试用例:添加小游戏任务类型测试(MINITASK-001~004),更新需求同步文件

Sisyphus 6 месяцев назад
Родитель
Сommit
3bac8407e2
2 измененных файлов с 74 добавлено и 12 удалено
  1. 20 11
      docs/系统测试/.test-sync.json
  2. 54 1
      docs/系统测试/test-cases.js

+ 20 - 11
docs/系统测试/.test-sync.json

@@ -1,5 +1,5 @@
 {
 {
-  "timestamp": "2026-04-17T00:38:38.079Z",
+  "timestamp": "2026-04-17T01:26:43.879Z",
   "requirements": [
   "requirements": [
     {
     {
       "id": "TASK-001",
       "id": "TASK-001",
@@ -835,26 +835,35 @@
       "subModule": "模板生成"
       "subModule": "模板生成"
     },
     },
     {
     {
-      "id": "GAME-001",
-      "description": "小游戏任务类型-舒尔特方格(专注力训练)",
+      "id": "MINITASK-001",
+      "description": "Task实体添加minigameCode字段支持小游戏任务",
       "priority": "P1",
       "priority": "P1",
       "module": "任务管理模块",
       "module": "任务管理模块",
       "subModule": "小游戏任务",
       "subModule": "小游戏任务",
-      "hasTestCase": true,
-      "testCaseFile": "./test-cases.js"
+      "hasTestCase": false,
+      "testCaseFile": null
     },
     },
     {
     {
-      "id": "GAME-002",
-      "description": "小游戏任务类型-猜数字(1a2b)逻辑推理训练",
+      "id": "MINITASK-002",
+      "description": "创建小游戏类任务(category=小游戏类,minigameCode必填)",
       "priority": "P1",
       "priority": "P1",
       "module": "任务管理模块",
       "module": "任务管理模块",
       "subModule": "小游戏任务",
       "subModule": "小游戏任务",
-      "hasTestCase": true,
-      "testCaseFile": "./test-cases.js"
+      "hasTestCase": false,
+      "testCaseFile": null
+    },
+    {
+      "id": "MINITASK-003",
+      "description": "完成小游戏任务时调用MiniGameService计算积分",
+      "priority": "P1",
+      "module": "任务管理模块",
+      "subModule": "小游戏任务",
+      "hasTestCase": false,
+      "testCaseFile": null
     },
     },
     {
     {
-      "id": "GAME-003",
-      "description": "小游戏任务类型-数独策略与数学思维训练",
+      "id": "MINITASK-004",
+      "description": "小游戏任务记录到任务历史并同步积分到PointsLog",
       "priority": "P1",
       "priority": "P1",
       "module": "任务管理模块",
       "module": "任务管理模块",
       "subModule": "小游戏任务",
       "subModule": "小游戏任务",

+ 54 - 1
docs/系统测试/test-cases.js

@@ -706,6 +706,56 @@ class API_017_TestCase extends ApiTestCase {
  }
  }
 }
 }
 
 
+/**
+* API-018: 创建小游戏类任务(minigameCode字段)
+*/
+class API_018_TestCase extends ApiTestCase {
+ constructor() {
+  super('API-018', '创建小游戏类任务', 'P1', '/api/tasks', 'POST');
+ }
+
+ async run() {
+  try {
+   this.requestData = {
+    childId: 2,
+    title: '完成舒尔特方格训练',
+    category: '小游戏类',
+    minigameCode: 'schulte',
+    points: 5,
+    deadline: '2026-04-20T18:00:00',
+    needReview: 0
+   };
+   const response = await this.sendRequest(this.requestData);
+   this.logResult(response.status === 200);
+  } catch (error) {
+   this.logResult(false, error);
+  }
+ }
+}
+
+/**
+* API-019: 完成小游戏任务(调用MiniGameService)
+*/
+class API_019_TestCase extends ApiTestCase {
+ constructor() {
+  super('API-019', '完成小游戏任务获积分', 'P1', '/api/tasks/1/complete', 'POST');
+ }
+
+ async run() {
+  try {
+   this.requestData = {
+    childId: 2,
+    completionTime: 45,
+    score: 80
+   };
+   const response = await this.sendRequest(this.requestData);
+   this.logResult(response.status === 200);
+  } catch (error) {
+   this.logResult(false, error);
+  }
+ }
+}
+
 // ============================================================================
 // ============================================================================
 // Web管理端 浏览器测试用例
 // Web管理端 浏览器测试用例
 // ============================================================================
 // ============================================================================
@@ -1223,7 +1273,10 @@ module.exports = {
   API_014_TestCase, // 指导师审核任务
   API_014_TestCase, // 指导师审核任务
   API_015_TestCase, // 小游戏-舒尔特方格
   API_015_TestCase, // 小游戏-舒尔特方格
   API_016_TestCase, // 小游戏-猜数字
   API_016_TestCase, // 小游戏-猜数字
-  API_017_TestCase  // 任务模板创建
+  API_017_TestCase, // 任务模板创建
+  // 小游戏任务类型(新增)
+  API_018_TestCase, // 创建小游戏类任务
+  API_019_TestCase  // 完成小游戏任务获积分
  },
  },
   
   
 // Web浏览器测试用例(管理后台)
 // Web浏览器测试用例(管理后台)