fix(admin): restore teacher profile form values
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { userProfileResponseToFormValues } from './user-profile-form';
|
||||
|
||||
describe('user profile form mapping', () => {
|
||||
it('unwraps the nested profile returned by the user profile endpoint', () => {
|
||||
expect(
|
||||
userProfileResponseToFormValues({
|
||||
id: 9,
|
||||
username: 'teacher01',
|
||||
name: '测试教师',
|
||||
profile: {
|
||||
joinedAt: '2026-07-01',
|
||||
qualifications: '教师资格证',
|
||||
subjects: ['语文', '历史'],
|
||||
},
|
||||
}),
|
||||
).toEqual({
|
||||
joinedAt: '2026-07-01',
|
||||
qualifications: '教师资格证',
|
||||
subjects: ['语文', '历史'],
|
||||
});
|
||||
});
|
||||
|
||||
it('returns empty form values when the user has no profile', () => {
|
||||
expect(userProfileResponseToFormValues({ profile: null })).toEqual({});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user