You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
2.2 KiB
JavaScript
52 lines
2.2 KiB
JavaScript
import assert from "node:assert";
|
|
import fs from "node:fs";
|
|
import path from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
import {
|
|
LESSON_PLAN_MODULES,
|
|
buildTeachingPlanPrompt,
|
|
buildTeachingPlanRequest,
|
|
} from "../src/views/analysis-of-students/lessonPlanPrompt.mjs";
|
|
|
|
const expectedModules = [
|
|
"互联网产品开发基础认知",
|
|
"市场洞察与需求分析",
|
|
"产品规划与设计",
|
|
"产品开发与测试验证",
|
|
"产品上线与运营推广",
|
|
"综合实训",
|
|
];
|
|
|
|
assert.deepStrictEqual(LESSON_PLAN_MODULES, expectedModules, "lesson-plan module selector must expose the six current modules");
|
|
|
|
const prompt = buildTeachingPlanPrompt("市场洞察与需求分析");
|
|
assert.match(prompt, /互联网产品开发实训课程/, "prompt must identify the course");
|
|
assert.match(prompt, /市场洞察与需求分析/, "prompt must identify the selected module");
|
|
for (const section of ["教学目标", "实训任务", "实施步骤", "预期成果", "评价要点"]) {
|
|
assert.match(prompt, new RegExp(section), `prompt must require ${section}`);
|
|
}
|
|
|
|
const customized = buildTeachingPlanRequest(
|
|
"市场洞察与需求分析",
|
|
"生成两课时教案",
|
|
"学校教案模板.docx",
|
|
"一、教学目标\n二、教学过程",
|
|
);
|
|
assert.match(customized, /生成两课时教案/, "teacher-edited prompt must be used");
|
|
assert.match(customized, /学校教案模板\.docx/, "template name must be identified");
|
|
assert.match(customized, /一、教学目标/, "template content must be included in the generation request");
|
|
|
|
const currentDirectory = path.dirname(fileURLToPath(import.meta.url));
|
|
const page = fs.readFileSync(
|
|
path.join(currentDirectory, "..", "src", "views", "analysis-of-students", "training-lesson-plan.vue"),
|
|
"utf8",
|
|
);
|
|
assert.match(page, /openLessonPlanSetup/, "module click must open setup instead of generating immediately");
|
|
assert.doesNotMatch(page, /@click="generateTeachingPlan\(item\)"/, "module click must not generate immediately");
|
|
assert.match(page, /参考提示词/);
|
|
assert.match(page, /学校参考模板/);
|
|
assert.match(page, /生成教案/);
|
|
assert.match(page, /grid-template-columns: repeat\(3/, "laptop layout must use a compact three-column grid");
|
|
|
|
console.log("AI training lesson plan checks passed");
|