演示数据生成逻辑微调
Build and publish Docker images / Test, build and publish (push) Successful in 11m47s

This commit is contained in:
2026-07-21 20:43:04 +08:00 Unverified
parent 207d75696b
commit 6f2cf2ded4
2 changed files with 20 additions and 5 deletions
+10
View File
@@ -7,8 +7,10 @@ const mainRegistrations = state.registrations.filter(registration => registratio
const mainRegistrationIds = new Set(mainRegistrations.map(registration => registration.id));
const mainResults = state.results.filter(result => mainRegistrationIds.has(result.registrationId));
const mainPreferences = state.admissionRecords.filter(record => record.kind === 'preference' && record.examId === mainExam.id && Number(record.payload?.round || 1) === 1);
const mainPlans = state.admissionRecords.filter(record => record.kind === 'plan' && record.examId === mainExam.id && record.status === 'approved');
const specialtyProfiles = state.candidateProfiles.filter(profile => profile.specialtyCategory && profile.specialtyType);
const specialtyUserIds = new Set(specialtyProfiles.map(profile => profile.userId));
const profilesByUserId = new Map(state.candidateProfiles.map(profile => [profile.userId, profile]));
assert.ok(state.exams.length >= 2, '演示数据至少包含两场考试');
assert.equal(state.schools.filter(school => school.isSourceSchool).length, 5, '演示数据应包含 5 所生源校');
@@ -22,8 +24,16 @@ assert.equal(mainResults.length, 1200 * 9, '每名主考试考生都应有完整
assert.ok(mainResults.every(result => result.published), '主考试成绩应全部发布');
assert.equal(mainPreferences.length, 1200, '主考试每名考生都应完成第一轮志愿');
assert.ok(mainPreferences.every(record => record.status === 'submitted' && record.payload.submissionCount === 1 && record.payload.choices.length === 3), '第一轮志愿应提交并填满 3 个招生校');
assert.equal(mainPlans.length, 3, '三所招生校都应有已审核通过的招生计划');
assert.ok(mainPlans.every(plan => plan.payload.categories.find(category => category.code === 'general')?.quota === 350), '每所招生校普通类计划应为 350 人');
assert.ok(mainPlans.every(plan => plan.payload.categories.filter(category => category.specialtyCategory).reduce((sum, category) => sum + category.quota, 0) === 2), '每所招生校特长生计划合计应为 2 人');
assert.equal(specialtyProfiles.length, 150, '应有 150 名特长生');
assert.ok(mainRegistrations.filter(registration => specialtyUserIds.has(registration.userId)).every(registration => registration.featureScore >= 80 && registration.featureScore <= 100), '特长生特征分应分布在 80-100 分');
assert.ok(mainPreferences.every(preference => {
const profile = profilesByUserId.get(preference.userId);
const categories = preference.payload.choices.map(choice => choice.categoryCode);
return profile.specialtyCategory ? categories[0] === profile.specialtyCategory && categories.slice(1).every(code => code === 'general') : categories.every(code => code === 'general');
}), '特长生第一志愿应匹配本人特长类别,其余志愿及普通考生志愿应填报普通类');
assert.deepEqual(new Set(state.users.map(user => user.passwordHash)), new Set(['test-12345678']), '所有预置账号密码应统一为 12345678');
for (const subject of mainExam.subjects) {