@ -8,6 +8,7 @@ const studentPage = fs.readFileSync(path.join(root, "src/views/training/GenericT
const newProductSurveyPage = fs . readFileSync ( path . join ( root , "src/views/foundation/new-product-survey.vue" ) , "utf8" ) ;
const productDevelopmentFactorsPage = fs . readFileSync ( path . join ( root , "src/views/foundation/product-development-factors.vue" ) , "utf8" ) ;
const trainingIntro = fs . readFileSync ( path . join ( root , "src/views/components/TrainingIntro.vue" ) , "utf8" ) ;
const materialButton = fs . readFileSync ( path . join ( root , "src/views/components/TrainingMaterialButton.vue" ) , "utf8" ) ;
const directStudentBriefFiles = [
"src/views/demand/index.vue" ,
"src/views/demand/environment.vue" ,
@ -47,6 +48,35 @@ assert(
/TrainingMaterialButton/ . test ( productDevelopmentFactorsPage ) ,
"product development factors page should render the case material button"
) ;
assert . match (
materialButton ,
/function normalizeMaterialUrl\(rawUrl\)/ ,
"case material downloads must normalize legacy absolute URLs"
) ;
assert . ok (
materialButton . includes ( '["localhost", "127.0.0.1", "::1"]' ) ,
"localhost case material URLs must not be sent to each student's own browser port"
) ;
assert . match (
materialButton ,
/url: normalizeMaterialUrl\(url\)/ ,
"the download button must use the normalized material URL"
) ;
assert . match (
materialButton ,
/async function handleDownload\(\)/ ,
"case material downloads must validate the file response before opening a download"
) ;
assert . match (
materialButton ,
/await fetch\(material\.value\.url\)/ ,
"case material downloads must request the configured file URL"
) ;
assert . match (
materialButton ,
/案例资料文件不存在或暂不可下载/ ,
"a missing case material file must show a clear recovery message"
) ;
const studentBriefPages = [ studentPage , newProductSurveyPage , productDevelopmentFactorsPage , trainingIntro , ... directStudentBriefPages ] ;
assert ( /实训背景/ . test ( trainingTaskBrief ) && /实训目标/ . test ( trainingTaskBrief ) && /实训要求/ . test ( trainingTaskBrief ) , "common TrainingTaskBrief component should render the three student brief sections" ) ;