Files
hermes-ui/tests/client/chat-panel-session-click.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

51 lines
2.7 KiB
TypeScript

import { readFileSync } from 'fs'
import { describe, expect, it } from 'vitest'
describe('ChatPanel session clicks', () => {
it('switches the store when the route is already on the clicked session', () => {
const source = readFileSync('packages/client/src/components/hermes/chat/ChatPanel.vue', 'utf8')
expect(source).toContain('if (chatStore.activeSessionId !== sessionId)')
expect(source).toContain('await chatStore.switchSession(sessionId)')
})
it('allows session model switching for coding agent sessions', () => {
const source = readFileSync('packages/client/src/components/hermes/chat/ChatPanel.vue', 'utf8')
expect(source).toContain('contextSession.value?.source === "coding_agent"')
expect(source).toContain('isSessionModelScopedCodingAgent')
expect(source).toContain('!isCodingAgentAuthProvider(group.provider)')
expect(source).toContain('showSessionModelModeModal')
expect(source).toContain('pendingSessionModelSwitch')
expect(source).toContain('chatStore.switchSessionModel(model, provider, sessionModelSessionId.value, apiMode)')
expect(source).not.toContain('header-model-button--readonly')
expect(source).not.toContain('if (isActiveSessionCodingAgent.value) return')
})
it('uses codingAgentId when deciding whether session model switches need an API mode', () => {
const source = readFileSync('packages/client/src/components/hermes/chat/ChatPanel.vue', 'utf8')
expect(source).toContain('const sessionModelCodingAgentId = computed<ChatCodingAgentId | undefined>')
expect(source).toContain('sessionModelSession.value?.codingAgentId ||')
expect(source).toContain('sessionModelSession.value?.agent === "claude"')
expect(source).toContain('sessionModelCodingAgentId.value === "claude-code"')
expect(source).not.toContain('sessionModelSession.value?.agent === "claude-code"')
})
it('uses the active sidebar model as the new chat default for the active profile', () => {
const source = readFileSync('packages/client/src/components/hermes/chat/ChatPanel.vue', 'utf8')
expect(source).toContain('const selectedProvider = appStore.selectedProvider || ""')
expect(source).toContain('const selectedModel = appStore.selectedModel || ""')
expect(source).toContain('profile === activeProfileName')
expect(source).toContain('selectedGroup?.models.includes(selectedModel)')
})
it('uses a create action in the new chat drawer instead of duplicating the new chat trigger label', () => {
const source = readFileSync('packages/client/src/components/hermes/chat/ChatPanel.vue', 'utf8')
expect(source).toContain('{{ t("common.create") }}')
expect(source).not.toContain('{{ t("chat.newChat") }}\n </NButton>')
})
})