diff --git a/app.config.js b/app.config.js index ef4c47a..218aedd 100644 --- a/app.config.js +++ b/app.config.js @@ -78,7 +78,9 @@ export default { // 业务接口基地址(规范 §1)。默认生产 HTTPS 域名;联调/本地可用环境变量 API_BASE_URL 覆盖。 apiBaseUrl: process.env.API_BASE_URL || 'https://job.youthome.com.cn/api/v1', // mock 开关:联调期为 false 统一走真实后端;业务函数按接口是否已接通决定是否绕过 mock。 - apiUseMock: false, + // 2026-09-29 接真实后端(求职端核心闭环)期间先恢复 true 兜底: + // 已接好真实分支的接口走后端,未接的继续走 mock,保证 App 随时可跑、不回归。 + apiUseMock: true, // EAS 项目 ID:`eas init` 后会自动注入此处(与 updates.url 中的 PROJECT_ID 对应)。 eas: { projectId: 'REPLACE_WITH_PROJECT_ID', diff --git a/app/(tabs)/profile.tsx b/app/(tabs)/profile.tsx index 7a43310..768d0d3 100644 --- a/app/(tabs)/profile.tsx +++ b/app/(tabs)/profile.tsx @@ -304,7 +304,8 @@ export default function ProfileScreen() { {PREF_ITEMS.map(({ key, label }, index) => { - const value = preference[key]; + // 兜底:preference[key] 运行时可能为 undefined(存储数据缺字段 / 后端 partial 响应) + const value = preference[key] ?? ''; const isLast = index === PREF_ITEMS.length - 1; // 未采集到的项显示「未设置」,不拿空串冒充已填;也就不再显示状态圆点 const isUnset = value.trim() === ''; diff --git a/src/__tests__/password.test.ts b/src/__tests__/password.test.ts index b4ec253..070d822 100644 --- a/src/__tests__/password.test.ts +++ b/src/__tests__/password.test.ts @@ -232,6 +232,8 @@ describe('resetPassword(重置 / 首次设置密码)', () => { }); describe('changePassword(已登录态改密)', () => { + beforeAll(() => setMockMode(true)); + it('未填原密码时拒绝', async () => { await expect( changePassword({ oldPassword: '', newPassword: 'abc12345', confirmPassword: 'abc12345' }), diff --git a/src/__tests__/profile-resume.test.ts b/src/__tests__/profile-resume.test.ts index 452bdbf..7511981 100644 --- a/src/__tests__/profile-resume.test.ts +++ b/src/__tests__/profile-resume.test.ts @@ -86,12 +86,12 @@ describe('个人资料 / 简历 域 mock 开关', () => { it('真实模式:fetchUserProfile 先打 /profile/me(后端字段空时兜底 /auth/me)', async () => { setMockMode(false); - // 后端 /profile/me 返回的字段名(nickname / avatarUrl),不是前端 UserProfile 的 name / avatarKey - responder = () => okData({ nickname: '张三', avatarUrl: 'a1' }); + // 后端 StudentProfileResponse 字段名:realName / location / education 等 + responder = () => okData({ realName: '张三', location: '北京', education: '本科' }); const profile = await fetchUserProfile(); // 第一个请求应该是 /profile/me expect(fetchCalls[0].url).toBe(`${API_BASE_URL}/profile/me`); - // profile 非空时不请求 auth/me,直接用后端字段映射 + // profile 关键字段非空时不请求 auth/me,直接用后端字段映射 expect(fetchCalls.length).toBe(1); expect(profile.name).toBe('张三'); expect(profile.avatar).toBe('张');