Files
hermes-desktop/tests/client/chat-panel-session-click.test.ts
toor 01d9e301fc
Build / build (push) Canceled after 0s
Playwright / browser (push) Canceled after 0s
initialize Electron desktop app and remove unused files
2026-10-25 01:09:01 +08:00

44 lines
2.1 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('switches the session model without a protocol mode modal', () => {
const source = readFileSync('packages/client/src/components/hermes/chat/ChatPanel.vue', 'utf8')
expect(source).toContain('chatStore.switchSessionModel(model, provider, sessionModelSessionId.value)')
expect(source).not.toContain('showSessionModelModeModal')
expect(source).not.toContain('pendingSessionModelSwitch')
expect(source).not.toContain('header-model-button--readonly')
})
it('does not gate session model switching on a coding agent id', () => {
const source = readFileSync('packages/client/src/components/hermes/chat/ChatPanel.vue', 'utf8')
expect(source).not.toContain('sessionModelCodingAgentId')
expect(source).not.toContain('isSessionModelScopedCodingAgent')
})
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>')
})
})