R64 A1-A6:新员工入门引导

这个提交包含在:
2026-04-14 16:45:10 +08:00
父节点 86644a6766
当前提交 7ac0de660c
共修改 12 个文件,包含 453 行新增和 5 行删除
+42
查看文件
@@ -14,6 +14,12 @@ function createPrismaState(overrides = {}) {
department_id: 'department-1',
direct_manager_id: 'manager-1',
status: 'active',
emergency_contact_name: null,
emergency_contact_phone: null,
bank_account_encrypted: '',
bank_name: '',
avatar_path: null,
id_number_encrypted: null,
notification_push_enabled: true,
roles: [{ role_code: 'employee' }],
wecom_identity_binding: null,
@@ -107,12 +113,48 @@ describe('me routes', () => {
expect.objectContaining({
id: 'employee-1',
notificationPushEnabled: false,
profileCompleteness: {
hasEmergencyContact: false,
hasBankAccount: false,
hasAvatar: false,
hasIdNumber: false,
score: 0,
},
}),
);
await app.close();
});
it('calculates profileCompleteness score from completed profile fields', async () => {
const { prisma } = createPrismaState({
emergency_contact_name: '联系人',
emergency_contact_phone: '13900000000',
bank_account_encrypted: 'ENC',
bank_name: '招商银行',
avatar_path: null,
id_number_encrypted: null,
});
const app = await buildApp(prisma);
const response = await app.inject({
method: 'GET',
url: '/api/me',
headers: { authorization: 'Bearer test-token' },
});
expect(response.statusCode).toBe(200);
expect(response.json().data.profileCompleteness).toEqual({
hasEmergencyContact: true,
hasBankAccount: true,
hasAvatar: false,
hasIdNumber: false,
score: 50,
});
await app.close();
});
it('updates notification preferences for current employee', async () => {
const { prisma, employeeRecord, auditEntries } = createPrismaState();
const app = await buildApp(prisma);