mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-10-14 12:02:27 +08:00
fix(profile): recognize DingTalk profile sources
This commit is contained in:
@@ -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: {
|
||||
|
||||
Reference in New Issue
Block a user