Browse Source

test(admin): verify member identity conflicts

彭峰 1 month ago
parent
commit
ff7fe6a78f
1 changed files with 3 additions and 1 deletions
  1. 3 1
      scripts/smoke-operations-functions.mjs

+ 3 - 1
scripts/smoke-operations-functions.mjs

@@ -68,6 +68,8 @@ try {
   if (!named.items?.some((item) => item.displayName === '万宇昊')) throw new Error('用户显示名称兜底未找到“万宇昊”');
   const legacyAdmin = (await ops({ operation: 'ops/users/list', page: 1, pageSize: 20, search: 'admin' })).data;
   if (legacyAdmin.items?.some((item) => String(item.username || '').toLowerCase() === 'admin')) throw new Error('Manager 表中的历史管理员仍混入会员列表');
+  const identityConflicts = (await ops({ operation: 'ops/users/identity-conflicts', page: 1, pageSize: 100, search: '' })).data;
+  if (!Array.isArray(identityConflicts.items) || identityConflicts.items.some((item) => item.currentGroupId !== 1 || item.recommendedGroupId !== 3 || !item.evidence)) throw new Error('会员身份异常预览结构无效');
 
   const coaches = (await ops({ operation: 'ops/coaches/list', page: 1, pageSize: 20, search: '' })).data;
   if (!Array.isArray(coaches.items) || coaches.items.some((item) => !item.userId || !item.displayName)) throw new Error('陪练老师业务投影无效');
@@ -97,7 +99,7 @@ try {
 
   const denied = await call('xiaoshu/admin/gateway', token, { operation: 'catalog' }, 403);
   if (denied.success !== false) throw new Error('普通运营管理员仍可访问技术数据目录');
-  console.log(`Operations smoke passed: users=${users.total}, coaches=${coaches.total}, activeCoaches=${activeCoaches.total}, dashboardCoaches=${dashboardCoachMetric.value}, liveCoachAppointments=${coaches.liveSourceCount}, appointments=${schedule.totalAppointments}, latest=${latestSchedule.appointments.length}, metrics=${dashboard.metrics.length}, learning=${JSON.stringify(learningCounts)}.`);
+  console.log(`Operations smoke passed: users=${users.total}, coaches=${coaches.total}, activeCoaches=${activeCoaches.total}, dashboardCoaches=${dashboardCoachMetric.value}, liveCoachAppointments=${coaches.liveSourceCount}, appointments=${schedule.totalAppointments}, latest=${latestSchedule.appointments.length}, identityConflicts=${identityConflicts.total}, conflictNames=${identityConflicts.items.map((item) => item.displayName).join('|') || 'none'}, metrics=${dashboard.metrics.length}, learning=${JSON.stringify(learningCounts)}.`);
 } finally {
   if (userId) {
     const sessions = await request(`${PARSE_URL}/classes/_Session?where=${encodeURIComponent(JSON.stringify({ user: { __type: 'Pointer', className: '_User', objectId: userId } }))}&limit=1000`, {}, true).catch(() => ({ results: [] }));