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.
28 lines
2.6 KiB
JavaScript
28 lines
2.6 KiB
JavaScript
const assert = require("assert");
|
|
const fs = require("fs");
|
|
const path = require("path");
|
|
|
|
const root = path.resolve(__dirname, "..");
|
|
const api = fs.readFileSync(path.join(root, "src/api/aiTrainingEvaluation.js"), "utf8");
|
|
const component = fs.readFileSync(path.join(root, "src/views/components/TrainingAiEvaluation.vue"), "utf8");
|
|
const page = fs.readFileSync(path.join(root, "src/views/training/GenericTrainingPage.vue"), "utf8");
|
|
|
|
assert(/`\/api\/student\/training-tasks\/\$\{taskKey\}\/ai-evaluation`/.test(api), "evaluation API should use the student task endpoint");
|
|
assert(/\/help/.test(api) && /\/assessment/.test(api), "evaluation API should expose help and assessment operations");
|
|
assert(/TrainingAiEvaluation/.test(page) && /:has-any-answer="hasAnyAnswer"/.test(page), "generic training page should pass meaningful answer state to AI evaluation");
|
|
assert(/form\.value/.test(page) && /workRows\.value/.test(page) && /processRows\.value/.test(page), "hasAnyAnswer should inspect all supported answer shapes");
|
|
assert(/<TrainingAiEvaluation[\s\S]*<TrainingAiSidebar/.test(page), "AI evaluation should render before the existing AI sidebar");
|
|
|
|
assert(/onMounted\(/.test(component) && /watch\(\s*\(\)\s*=>\s*props\.taskKey/.test(component), "AI evaluation should load on mount and task changes");
|
|
assert(/AI助学/.test(component) && /AI助评/.test(component), "AI evaluation should offer separate help and assessment controls");
|
|
assert(/PROCESSING/.test(component) && /SUCCEEDED/.test(component), "AI evaluation should surface backend statuses");
|
|
assert(/!props\.hasAnyAnswer/.test(component), "AI actions should disable when no answer is available");
|
|
assert(/proxy\?\.\$modal\?\.confirm/.test(component), "assessment should request confirmation through the modal proxy");
|
|
assert(!/v-html/.test(component), "AI reports must be rendered as interpolated text, never v-html");
|
|
assert(/scoreCriteria/.test(component), "assessment should display score criteria");
|
|
assert(/helpReportJson/.test(component) && /assessmentReportJson/.test(component), "flat backend report JSON fields should be mapped for display");
|
|
assert(/assessmentScore/.test(component), "flat backend assessmentScore should be mapped to the displayed score");
|
|
assert(/safeParseJson/.test(component), "flat report JSON should be parsed defensively");
|
|
assert(/safeParseJson\([^)]*assessmentReportJson[^)]*\)[\s\S]*criteria|criteria[\s\S]*safeParseJson\([^)]*assessmentReportJson[^)]*\)/.test(component), "score criteria should be read from parsed assessmentReportJson");
|
|
assert(/retry/.test(component) || /重试/.test(component), "failed AI operations should expose a retry action");
|