fix: address review feedback for models and routing

This commit is contained in:
bnvnvnv
2026-03-12 05:51:53 +00:00
parent 5a7531f635
commit 1da3608d42
10 changed files with 444 additions and 44 deletions
@@ -30,6 +30,29 @@ describe('tokenBindingPresentation', () => {
expect(result.helperText).toContain('不会跟着变');
});
it('describes fixed mode when the selected token is not the account default', () => {
const result = describeTokenBinding([
{ id: 1, name: 'default', isDefault: true },
{ id: 2, name: 'backup', isDefault: false },
], 2);
expect(result.bindingModeLabel).toBe('固定令牌');
expect(result.effectiveTokenName).toBe('backup');
expect(result.helperText).toContain('不会随账号默认变化');
});
it('describes follow-account-default mode when no default token exists yet', () => {
const result = describeTokenBinding([
{ id: 2, name: 'backup', isDefault: false },
{ id: 3, name: 'spare', isDefault: false },
], 0);
expect(result.bindingModeLabel).toBe('跟随账号默认');
expect(result.effectiveTokenName).toBe('未设置默认令牌');
expect(result.helperText).toContain('当前账号还没有默认令牌');
expect(result.followOptionDescription).toContain('以后账号默认变化时会自动切换');
});
it('formats fixed token options with clearer labels and descriptions', () => {
const token = {
id: 3,