🐛 fix: 修复 PR 评审发现的 11 项问题

- data.data 空值保护:data?.data?.eSims 防止 TypeError
- directFetchMode 移至成功路径设置,失败时重置为 false
- SMS 卡片切换时隐藏 directFetchSection,避免双内联区同时可见
- modeBadge 直取模式下隐藏"设备更换"徽标
- tl() 文案迁移至 LITERAL_TRANSLATIONS,修复英文环境回退中文
- "拉取中"状态类型从 success 改为 info
- SSN radio 查询限定到 picker 容器内
- jest.config 补全 .spec.js 排除规则
- innerHTML 改用 DOM API 构建(pullBtn + renderSsnPicker)
- 测试 fail() 替换为 expect().rejects 惯用写法
This commit is contained in:
Abner
2026-05-28 20:12:19 +08:00
parent 60c3bd1cce
commit 75da15edff
6 changed files with 59 additions and 44 deletions

View File

@@ -149,13 +149,10 @@ describe('ESimService - directFetchFlow', () => {
})
});
try {
await esimService.directFetchFlow();
fail('应抛出 MULTIPLE_ESIMS 错误');
} catch (error) {
expect(error.code).toBe('MULTIPLE_ESIMS');
expect(error.candidates).toEqual(['A', 'B']);
}
await expect(esimService.directFetchFlow()).rejects.toMatchObject({
code: 'MULTIPLE_ESIMS',
candidates: ['A', 'B']
});
});
test('多 eSIM 已选定 preselectedSsn 时直接使用该 ssn', async () => {
@@ -191,12 +188,9 @@ describe('ESimService - directFetchFlow', () => {
})
});
try {
await esimService.directFetchFlow();
fail('应抛出 EMPTY_LIST 错误');
} catch (error) {
expect(error.code).toBe('EMPTY_LIST');
}
await expect(esimService.directFetchFlow()).rejects.toMatchObject({
code: 'EMPTY_LIST'
});
});
});
});