Files
hermes-ui/tests/client/use-voice-settings-mimo.test.ts
T
toor 1e9ea89d86
Build / build (push) Canceled after 0s
NPM Lockfile Check / npm ci --ignore-scripts (push) Canceled after 0s
Playwright / e2e (push) Canceled after 0s
chore: bootstrap hermes-ui skeleton from 0.6.29 snapshot
Import the client, server, skills, tests, and build scripts as the starting
point for the rebuild, then trim the surfaces this project does not ship:
Electron desktop packaging, the marketing website, and the ESP32 firmware
tree. CI keeps the web build, e2e, lockfile, release, and Docker workflows.

Rename the package and CLI entry points to hermes-ui, drop the prepare hook so
npm ci no longer triggers a build, and drop the removed tsconfig and nodemon
references. Rewrite AGENTS.md, ARCHITECTURE.md, DEVELOPMENT.md, and the READMEs
so the documented package map and hard rules match this repository.

reference_code/ is ignored: it is a read-only snapshot, not an input to the build.
2026-10-16 10:34:35 +08:00

56 lines
2.0 KiB
TypeScript

// @vitest-environment jsdom
import { beforeEach, describe, expect, it, vi } from 'vitest'
import { nextTick } from 'vue'
const STORAGE_KEY = 'hermes-tts-settings-v2'
describe('useVoiceSettings MiMo settings', () => {
beforeEach(() => {
vi.resetModules()
localStorage.clear()
})
it('defaults MiMo auth and voice clone settings', async () => {
const { useVoiceSettings } = await import('../../packages/client/src/composables/useVoiceSettings')
const settings = useVoiceSettings()
expect(settings.mimoAuthMode.value).toBe('bearer')
expect(settings.mimoVoiceCloneDataUri.value).toBe('')
expect(settings.mimoVoiceCloneFileName.value).toBe('')
expect(settings.mimoVoiceCloneFormat.value).toBe('wav')
})
it('persists MiMo auth mode and voice clone fields', async () => {
const { useVoiceSettings } = await import('../../packages/client/src/composables/useVoiceSettings')
const settings = useVoiceSettings()
settings.setMimoAuthMode('api-key')
settings.setMimoModel('mimo-v2.5-tts-voiceclone')
settings.setMimoVoiceCloneDataUri('data:audio/mp3;base64,ZmFrZQ==')
settings.setMimoVoiceCloneFileName('sample.mp3')
settings.setMimoVoiceCloneFormat('mp3')
await nextTick()
expect(JSON.parse(localStorage.getItem(STORAGE_KEY) || '{}')).toMatchObject({
mimoAuthMode: 'api-key',
mimoModel: 'mimo-v2.5-tts-voiceclone',
mimoVoiceCloneDataUri: 'data:audio/mp3;base64,ZmFrZQ==',
mimoVoiceCloneFileName: 'sample.mp3',
mimoVoiceCloneFormat: 'mp3',
})
})
it('sanitizes invalid persisted MiMo auth mode and clone format', async () => {
localStorage.setItem(STORAGE_KEY, JSON.stringify({
mimoAuthMode: 'bad-mode',
mimoVoiceCloneFormat: 'ogg',
}))
const { useVoiceSettings } = await import('../../packages/client/src/composables/useVoiceSettings')
const settings = useVoiceSettings()
expect(settings.mimoAuthMode.value).toBe('bearer')
expect(settings.mimoVoiceCloneFormat.value).toBe('wav')
})
})