Files
hermes-ui/tests/client/group-chat-panel-workspace-source.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

34 lines
1.8 KiB
TypeScript

import { readFileSync } from 'node:fs'
import { describe, expect, it } from 'vitest'
describe('GroupChatPanel workspace save handling', () => {
it('coerces null picker values before trimming so clearing the input saves an empty workspace', () => {
const source = readFileSync('packages/client/src/components/hermes/group-chat/GroupChatPanel.vue', 'utf8')
expect(source).toContain("String(workspaceValue.value || '').trim()")
expect(source).not.toContain('workspaceValue.value.trim()')
})
it('gates workspace mutation controls to rooms the server marks manageable', () => {
const source = readFileSync('packages/client/src/components/hermes/group-chat/GroupChatPanel.vue', 'utf8')
expect(source).toContain('const currentRoomCanManage = computed(() => canManageRoom(currentRoom.value))')
expect(source).toContain('const visibleApproval = computed(() => currentRoomCanManage.value ? store.activePendingApproval : null)')
expect(source).toContain('if (!currentRoomCanManage.value) return')
expect(source).toContain('if (!canManageRoom(room)) return')
expect(source).toContain("options.push({ label: t('chat.setWorkspace'), key: 'set-workspace' })")
expect(source).toContain('v-if="currentRoomCanManage" class="context-stop-btn"')
})
it('renders the active room workspace badge beside the room title like single chat', () => {
const source = readFileSync('packages/client/src/components/hermes/group-chat/GroupChatPanel.vue', 'utf8')
expect(source).toContain('<div class="header-left">')
expect(source).toContain('class="workspace-badge"')
expect(source).toContain('v-if="currentRoom?.workspace"')
expect(source).toContain(':title="currentRoom.workspace"')
expect(source).not.toContain('class="workspace-chip"')
expect(source).not.toContain("currentWorkspaceLabel || t('chat.setWorkspace')")
})
})