Files
multica/tests/unit/main/utils/pathValidation.test.ts
LinYushen e203f2099b feat: auto-generate session titles and support manual title editing (#115)
- Add TitleGenerator module to generate session titles using Agent CLI
  - Support claude-code, opencode, and codex agents
  - Fire-and-forget async generation on first user message
  - Prevent concurrent generation with in-flight tracking
  - Re-check before update to avoid overwriting manual titles

- Add double-click to edit session title in sidebar
  - Inline editing with Enter to save, Escape to cancel
  - Blur saves by default, but respects Escape cancellation
  - Persist title changes to database

- Add SESSION_UPDATE IPC channel for title updates
- Add SESSION_META_UPDATED event for real-time UI sync
- Add comprehensive unit tests for new functionality

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-23 19:20:29 +08:00

21 lines
583 B
TypeScript

import { describe, expect, it } from 'vitest'
import { isValidPath } from '../../../../src/main/utils/pathValidation'
describe('isValidPath', () => {
it('accepts absolute POSIX paths', () => {
expect(isValidPath('/tmp/project')).toBe(true)
})
it('accepts absolute POSIX paths with trailing slash', () => {
expect(isValidPath('/tmp/project/')).toBe(true)
})
it('rejects relative paths', () => {
expect(isValidPath('tmp/project')).toBe(false)
})
it('rejects POSIX traversal segments', () => {
expect(isValidPath('/tmp/../secret')).toBe(false)
})
})