fix(profile): restore source hints and upload-only avatar

This commit is contained in:
IanShaw027
2026-04-21 18:23:35 +08:00
parent 7309c02f0b
commit 17c6348b57
6 changed files with 185 additions and 43 deletions

View File

@@ -88,6 +88,8 @@ function createUser(overrides: Partial<User> = {}): User {
async function flushAsyncWork(): Promise<void> {
await Promise.resolve()
await Promise.resolve()
await Promise.resolve()
await Promise.resolve()
}
const originalFileReader = globalThis.FileReader
@@ -156,6 +158,23 @@ describe('ProfileAvatarCard', () => {
vi.restoreAllMocks()
})
it('does not render a manual avatar input field', () => {
authStoreState.user = createUser()
const wrapper = mount(ProfileAvatarCard, {
props: {
user: authStoreState.user
},
global: {
stubs: {
Icon: true
}
}
})
expect(wrapper.find('[data-testid="profile-avatar-input"]').exists()).toBe(false)
})
it('compresses an uploaded image that exceeds the 20KB target before saving', async () => {
installAvatarCompressionMocks()
const updatedUser = createUser({ avatar_url: 'data:image/webp;base64,Y29tcHJlc3NlZC1hdmF0YXI=' })