83 lines
3.6 KiB
JavaScript
83 lines
3.6 KiB
JavaScript
|
|
// 测试企业内推岗位库和岗位面试状态的图片数据流
|
|||
|
|
const mockDataModule = require('./src/data/mockData.js');
|
|||
|
|
const mockData = mockDataModule.mockData;
|
|||
|
|
|
|||
|
|
console.log('🔍 测试企业内推岗位图片数据流\n');
|
|||
|
|
console.log('='.repeat(80));
|
|||
|
|
|
|||
|
|
// 1. 测试 companyPositions(企业内推岗位库数据)
|
|||
|
|
console.log('\n📊 1. 测试 mockData.companyJobs.companyPositions');
|
|||
|
|
const companyPositions = mockData.companyJobs.companyPositions || [];
|
|||
|
|
console.log(` 总岗位数: ${companyPositions.length}`);
|
|||
|
|
|
|||
|
|
const positionsWithImages = companyPositions.filter(job =>
|
|||
|
|
job.details?.companyImages && job.details.companyImages.length > 0
|
|||
|
|
);
|
|||
|
|
console.log(` 有图片的岗位数: ${positionsWithImages.length}`);
|
|||
|
|
|
|||
|
|
if (positionsWithImages.length > 0) {
|
|||
|
|
console.log('\n 前5个有图片的岗位:');
|
|||
|
|
positionsWithImages.slice(0, 5).forEach((job, index) => {
|
|||
|
|
console.log(` ${index + 1}. ${job.position}: ${job.details.companyImages.length}张图片`);
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 2. 测试 interviewStatus(岗位面试状态数据)
|
|||
|
|
console.log('\n\n📊 2. 测试 mockData.companyJobs.interviewStatus');
|
|||
|
|
const interviewStatus = mockData.companyJobs.interviewStatus || [];
|
|||
|
|
console.log(` 总面试状态数: ${interviewStatus.length}`);
|
|||
|
|
|
|||
|
|
const interviewsWithJobImages = interviewStatus.filter(interview =>
|
|||
|
|
interview.job?.companyImages && interview.job.companyImages.length > 0
|
|||
|
|
);
|
|||
|
|
console.log(` 岗位有图片的面试状态数: ${interviewsWithJobImages.length}`);
|
|||
|
|
|
|||
|
|
if (interviewsWithJobImages.length > 0) {
|
|||
|
|
console.log('\n 前5个岗位有图片的面试状态:');
|
|||
|
|
interviewsWithJobImages.slice(0, 5).forEach((interview, index) => {
|
|||
|
|
console.log(` ${index + 1}. ${interview.position}: ${interview.job.companyImages.length}张图片`);
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 3. 查找特定岗位
|
|||
|
|
console.log('\n\n🎯 3. 测试特定岗位(SEO专员)');
|
|||
|
|
|
|||
|
|
const seoInCompanyPositions = companyPositions.find(job => job.position === 'SEO专员');
|
|||
|
|
if (seoInCompanyPositions) {
|
|||
|
|
console.log(' ✅ 在companyPositions中找到SEO专员');
|
|||
|
|
console.log(` 有companyImages: ${!!seoInCompanyPositions.details?.companyImages}`);
|
|||
|
|
console.log(` 图片数量: ${seoInCompanyPositions.details?.companyImages?.length || 0}`);
|
|||
|
|
} else {
|
|||
|
|
console.log(' ❌ 在companyPositions中未找到SEO专员');
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
const seoInInterviewStatus = interviewStatus.find(interview => interview.position === 'SEO专员');
|
|||
|
|
if (seoInInterviewStatus) {
|
|||
|
|
console.log('\n ✅ 在interviewStatus中找到SEO专员');
|
|||
|
|
console.log(` 有job对象: ${!!seoInInterviewStatus.job}`);
|
|||
|
|
console.log(` job有companyImages: ${!!seoInInterviewStatus.job?.companyImages}`);
|
|||
|
|
console.log(` 图片数量: ${seoInInterviewStatus.job?.companyImages?.length || 0}`);
|
|||
|
|
|
|||
|
|
if (seoInInterviewStatus.job?.companyImages?.length > 0) {
|
|||
|
|
console.log(` 第一张图片: ${seoInInterviewStatus.job.companyImages[0]}`);
|
|||
|
|
}
|
|||
|
|
} else {
|
|||
|
|
console.log('\n ❌ 在interviewStatus中未找到SEO专员');
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// 4. 数据完整性检查
|
|||
|
|
console.log('\n\n🔎 4. 数据完整性检查');
|
|||
|
|
|
|||
|
|
const positionsWithoutImages = companyPositions.filter(job =>
|
|||
|
|
!job.details?.companyImages || job.details.companyImages.length === 0
|
|||
|
|
);
|
|||
|
|
console.log(` companyPositions中没有图片的岗位: ${positionsWithoutImages.length}个`);
|
|||
|
|
|
|||
|
|
const interviewsWithoutJobImages = interviewStatus.filter(interview =>
|
|||
|
|
!interview.job?.companyImages || interview.job.companyImages.length === 0
|
|||
|
|
);
|
|||
|
|
console.log(` interviewStatus中岗位没有图片的: ${interviewsWithoutJobImages.length}个`);
|
|||
|
|
|
|||
|
|
console.log('\n' + '='.repeat(80));
|
|||
|
|
console.log('\n✅ 测试完成!\n');
|