Files
prompt-optimizer/packages/ui/tests/unit/composables/useTestSourceAreaFeedback.spec.ts
linshen f25837b6cb feat(ui): polish workspace controls and source cues
- Link test source cues back to prompt panel areas

- Add source-linked cards, variant tags, and feedback composables

- Add image model quick switching and workspace control polish
2026-05-12 21:36:52 +08:00

36 lines
1.2 KiB
TypeScript

import { describe, expect, it } from 'vitest'
import {
getTestSourceAreaForSelection,
useTestSourceAreaFeedback,
} from '../../../src/composables/prompt/useTestSourceAreaFeedback'
describe('useTestSourceAreaFeedback', () => {
it('maps original selections to the original prompt area and all optimized sources to the workspace area', () => {
expect(getTestSourceAreaForSelection(0)).toBe('original')
expect(getTestSourceAreaForSelection('workspace')).toBe('workspace')
expect(getTestSourceAreaForSelection('previous')).toBe('workspace')
expect(getTestSourceAreaForSelection(3)).toBe('workspace')
})
it('records the semantic source tone for the physical area pulse', () => {
const { sourceAreaFeedback, pulseSourceAreaForSelection } = useTestSourceAreaFeedback()
pulseSourceAreaForSelection('previous', 2, 'change')
expect(sourceAreaFeedback.workspace).toMatchObject({
key: 1,
tone: 'change',
sourceTone: 'previous',
resolvedVersion: 2,
})
pulseSourceAreaForSelection(0, 0, 'error')
expect(sourceAreaFeedback.original).toMatchObject({
key: 1,
tone: 'error',
sourceTone: 'original',
resolvedVersion: 0,
})
})
})