feat(agent): use deterministic storage keys for preset avatars (#404)

This commit is contained in:
Yiling-J
2026-09-13 21:40:34 +08:00
committed by GitHub
parent 7d56b5bf90
commit ddbf897b27
6 changed files with 58 additions and 12 deletions
+7
View File
@@ -1,6 +1,7 @@
import { describe, expect, it } from 'vitest'
import {
getPresetAvatarBuffer,
getPresetAvatarStorageKey,
isPresetAvatarId,
PRESET_AVATAR_IDS,
type PresetAvatarId,
@@ -27,6 +28,12 @@ describe('agent presets', () => {
expect(getPresetAvatarBuffer('unknown' as PresetAvatarId)).toBeNull()
})
it('returns deterministic storage key for preset avatars', () => {
for (const id of PRESET_AVATAR_IDS) {
expect(getPresetAvatarStorageKey(id)).toBe(`files/avatars/${id}.webp`)
}
})
it('provides AVAILABLE_AVATARS with 8 previews via dtos', async () => {
const { AVAILABLE_AVATARS } = await import('@shumai/dtos')
expect(AVAILABLE_AVATARS).toHaveLength(8)