64 lines
2.1 KiB
JavaScript
64 lines
2.1 KiB
JavaScript
|
|
const fs = require('fs');
|
|||
|
|
|
|||
|
|
// 读取文件
|
|||
|
|
const content = fs.readFileSync('src/mocks/resumeInterviewMock.js', 'utf8');
|
|||
|
|
|
|||
|
|
// 使用eval来执行JS代码(仅用于调试)
|
|||
|
|
try {
|
|||
|
|
// 移除export语句
|
|||
|
|
const cleanContent = content
|
|||
|
|
.replace(/export\s+function/g, 'function')
|
|||
|
|
.replace(/export\s+const/g, 'const')
|
|||
|
|
.replace(/export\s+\{[^}]+\};?/g, '');
|
|||
|
|
|
|||
|
|
// 执行代码
|
|||
|
|
eval(cleanContent);
|
|||
|
|
|
|||
|
|
// 检查数据
|
|||
|
|
console.log('=== 数据完整性检查 ===\n');
|
|||
|
|
|
|||
|
|
console.log('Industries数量:', industries.length);
|
|||
|
|
console.log('ResumeTemplates键数量:', Object.keys(resumeTemplates).length);
|
|||
|
|
|
|||
|
|
console.log('\n=== Industries列表 ===');
|
|||
|
|
industries.forEach(ind => {
|
|||
|
|
console.log(`- ${ind.name} (${ind.positions.length}个岗位, ${ind.questions.length}个面试题组)`);
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
console.log('\n=== ResumeTemplates键列表 ===');
|
|||
|
|
Object.keys(resumeTemplates).forEach(key => {
|
|||
|
|
const templates = resumeTemplates[key];
|
|||
|
|
console.log(`- ${key}: ${templates.length}个模板`);
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
console.log('\n=== 数据匹配检查 ===');
|
|||
|
|
industries.forEach(ind => {
|
|||
|
|
const hasTemplate = resumeTemplates.hasOwnProperty(ind.name);
|
|||
|
|
if (!hasTemplate) {
|
|||
|
|
console.log(`❌ ${ind.name} 没有对应的resumeTemplates`);
|
|||
|
|
} else {
|
|||
|
|
console.log(`✓ ${ind.name} 有 ${resumeTemplates[ind.name].length} 个简历模板`);
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
console.log('\n=== 简历模板数据结构检查 ===');
|
|||
|
|
Object.keys(resumeTemplates).forEach(key => {
|
|||
|
|
const templates = resumeTemplates[key];
|
|||
|
|
templates.forEach((template, idx) => {
|
|||
|
|
const hasContent = !!template.content;
|
|||
|
|
const hasOriginal = !!template.content?.original;
|
|||
|
|
const hasModified = !!template.content?.modified;
|
|||
|
|
const hasStudentInfo = !!template.studentInfo;
|
|||
|
|
|
|||
|
|
if (!hasContent) {
|
|||
|
|
console.log(`❌ ${key}[${idx}] (${template.position}) 缺少content字段`);
|
|||
|
|
} else if (!hasOriginal || !hasModified) {
|
|||
|
|
console.log(`⚠️ ${key}[${idx}] (${template.position}) content缺少original或modified`);
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
});
|
|||
|
|
|
|||
|
|
} catch (error) {
|
|||
|
|
console.error('执行错误:', error.message);
|
|||
|
|
console.error('错误位置:', error.stack);
|
|||
|
|
}
|