fix(profile): recognize DingTalk profile sources

This commit is contained in:
chihao.ou
2026-09-22 21:49:27 +08:00
parent b0e32fe5be
commit 3eb4bae9ab
2 changed files with 15 additions and 0 deletions
@@ -281,6 +281,7 @@ function normalizeProvider(value: string): UserAuthProvider | null {
if (
normalized === 'email' ||
normalized === 'linuxdo' ||
normalized === 'dingtalk' ||
normalized === 'wechat' ||
normalized === 'github' ||
normalized === 'google'
@@ -35,6 +35,7 @@ vi.mock('vue-i18n', async (importOriginal) => {
if (key === 'profile.user') return 'User'
if (key === 'profile.authBindings.providers.email') return 'Email'
if (key === 'profile.authBindings.providers.linuxdo') return 'LinuxDo'
if (key === 'profile.authBindings.providers.dingtalk') return 'DingTalk'
if (key === 'profile.authBindings.providers.wechat') return 'WeChat'
if (key === 'profile.authBindings.providers.oidc') return params?.providerName || 'OIDC'
if (key === 'profile.authBindings.source.avatar') {
@@ -70,6 +71,19 @@ function createUser(overrides: Partial<User> = {}): User {
}
describe('ProfileInfoCard', () => {
it.each([
{ avatar_source: 'dingtalk', username_source: 'dingtalk' },
{ profile_sources: { avatar: { provider: 'dingtalk' }, username: { provider: 'dingtalk' } } },
])('shows DingTalk as the synchronized profile source', (sources) => {
const wrapper = mount(ProfileInfoCard, {
props: { user: createUser(sources), dingtalkEnabled: true },
global: { stubs: { Icon: true } },
})
expect(wrapper.text()).toContain('Avatar synced from DingTalk')
expect(wrapper.text()).toContain('Username synced from DingTalk')
wrapper.unmount()
})
it('renders basic account information inside the new overview shell', () => {
const wrapper = mount(ProfileInfoCard, {
props: {