0.134.20
Added
W-048: Vitest test suite for the web frontend — 312 unit/component tests across 23 files, covering pure utilities, formatters, state stores, chat, and forms. New
npm run testandnpm run test:watchscripts.vitest.config.tsconfigured with jsdom + SvelteKit plugin.lib/utils/:agentAge(pluralization, границы 29/30 дней, 12 мес, 1 год),agentColor,agentDisplayName,formatDate,clipboard(мок clipboard + fallback),safeStorage(мок localStorage ошибок)lib/features/memory/memoryFormat:actionLabel/actionBadge/confidenceColor/importanceColor/categoryBadge/wordDiff/formatFileSize/formatMimeBadge/computeMetrics/parseActions/константыlib/features/system/systemFormat:formatBytes/formatUptimeRu(все варианты склонения дней)/formatDiagText/getRestartInstructionForPlatform(darwin/linux/windows)lib/stores/:toast(auto-dismiss + таймер cancellation + dismissAll),reactions(optimistic + rollback),favorites(optimistic + rollback),avatar(URL с версией + bump)lib/features/chat/:chatDrafts(save/restore/cleanup TTL-индекс/clear),topicBreak(skip-флаг + 3-шаговый wizard),useChatCopy(timer + destroy cleanup),useChatScroll(stickToBottom threshold + rAF-throttle + loadMore)lib/stores/chat.svelte:mergeServerMessages(7 сценариев: пустой/пересечения/дедупликация/non-numeric id),ChatStoreWS-events (15+ событий: thinking/delta/stream_end/message/turn_end/error/retry/ask_user/tool_start/tool_end/agent_status/extraction/subagent/kg_progress)lib/features/profile/:usePassword(5 правил валидации + reset),useForgetMemory(3-шаговый wizard + expectedPhrase),useApiTokens(CRUD + copy + delete)W-049: Регрессионные XSS-тесты для
MarkdownRenderer— 9 тестов через@testing-library/svelte. Защищают W-004 (script в code-lang), W-013 (parseError), DOMPurify sanitization (script/event handlers/iframe/javascript: URL/data:text/html URL). Любое ослаблениеsafeLang/escapeAttrтеперь приведёт к падению тестов.Component-тесты:
CreateTokenModal.test.ts(18 тестов: формы создания/просмотра токена, валидация имени, backdrop click, Enter-to-submit),ForgetMemoryWizard.test.ts(11 тестов: 3-шаговый wizard, привязка к ctrl.input, отображение FORGET-фразы)
Fixed
- Добавлен
resolve.conditions: ['browser']вvitest.config.tsчтобы Vitest использовал client build Svelte (без этогоmount()падал сlifecycle_function_unavailable) useChatScrollrAF-throttle тесты обновлены: ожиданиеsetTimeout(50ms)вместо одного rAF (jsdom polyfill задерживает rAF иawait tick()в Svelte)