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.
71 lines
1.8 KiB
TypeScript
71 lines
1.8 KiB
TypeScript
// @vitest-environment jsdom
|
|
import { describe, expect, it, vi } from 'vitest'
|
|
import { mount } from '@vue/test-utils'
|
|
|
|
vi.mock('vue-i18n', () => ({
|
|
useI18n: () => ({
|
|
t: (key: string) => key,
|
|
}),
|
|
}))
|
|
|
|
vi.mock('naive-ui', async (importOriginal) => {
|
|
const actual = await importOriginal<typeof import('naive-ui')>()
|
|
return {
|
|
...actual,
|
|
useMessage: () => ({
|
|
error: vi.fn(),
|
|
success: vi.fn(),
|
|
warning: vi.fn(),
|
|
info: vi.fn(),
|
|
}),
|
|
}
|
|
})
|
|
|
|
vi.mock('@/api/hermes/download', () => ({
|
|
downloadFile: vi.fn(),
|
|
getDownloadUrl: vi.fn((path: string) => `/download?path=${encodeURIComponent(path)}`),
|
|
}))
|
|
|
|
vi.mock('@/components/hermes/chat/mermaidRenderer', () => ({
|
|
renderMermaidDiagram: vi.fn(),
|
|
}))
|
|
|
|
import MarkdownRenderer from '@/components/hermes/chat/MarkdownRenderer.vue'
|
|
|
|
describe('MarkdownRenderer special mentions', () => {
|
|
it('highlights @all as a mention when provided by group chat', () => {
|
|
const wrapper = mount(MarkdownRenderer, {
|
|
props: {
|
|
content: '@all, please compare options',
|
|
mentionNames: ['all', 'Alice'],
|
|
},
|
|
})
|
|
|
|
expect(wrapper.find('.mention-highlight').text()).toBe('@all')
|
|
})
|
|
|
|
it('highlights @all at the end of rendered paragraphs and after opening punctuation', () => {
|
|
for (const content of ['@all', 'please compare @all', '(@all)']) {
|
|
const wrapper = mount(MarkdownRenderer, {
|
|
props: {
|
|
content,
|
|
mentionNames: ['all', 'Alice'],
|
|
},
|
|
})
|
|
|
|
expect(wrapper.find('.mention-highlight').text()).toBe('@all')
|
|
}
|
|
})
|
|
|
|
it('does not highlight @alligator as @all', () => {
|
|
const wrapper = mount(MarkdownRenderer, {
|
|
props: {
|
|
content: '@alligator should stay plain',
|
|
mentionNames: ['all'],
|
|
},
|
|
})
|
|
|
|
expect(wrapper.find('.mention-highlight').exists()).toBe(false)
|
|
})
|
|
})
|