✨ feat(vscode): 支持重置回待办并修好待办依赖拖拽
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { canResetToTodo, todoResetStateExtra, todoResetUiPatch } from './todoReset'
|
||||
|
||||
describe('canResetToTodo', () => {
|
||||
it('允许从 in-progress 重置', () => {
|
||||
expect(canResetToTodo('in-progress')).toBe(true)
|
||||
})
|
||||
|
||||
it('允许从 review 重置', () => {
|
||||
expect(canResetToTodo('review')).toBe(true)
|
||||
})
|
||||
|
||||
it('已在 todo 不允许(handler 走 no-op)', () => {
|
||||
expect(canResetToTodo('todo')).toBe(false)
|
||||
})
|
||||
|
||||
it('done 不允许(handler 拒绝并 rollback)', () => {
|
||||
expect(canResetToTodo('done')).toBe(false)
|
||||
})
|
||||
})
|
||||
|
||||
describe('todoResetStateExtra', () => {
|
||||
it('清空实施痕迹并回到 todo,保留规划侧字段不在 extra 里', () => {
|
||||
const extra = todoResetStateExtra()
|
||||
expect(extra).toEqual({
|
||||
column: 'todo',
|
||||
branch: '',
|
||||
implementStatus: '',
|
||||
pr: '',
|
||||
prMerged: false,
|
||||
prMergedAt: '',
|
||||
worktreePath: '',
|
||||
implementSessionId: '',
|
||||
reviewSessionId: '',
|
||||
})
|
||||
expect(extra).not.toHaveProperty('sessionId')
|
||||
expect(extra).not.toHaveProperty('planFile')
|
||||
expect(extra).not.toHaveProperty('specFile')
|
||||
expect(extra).not.toHaveProperty('profilePath')
|
||||
expect(extra).not.toHaveProperty('brainstormProfilePath')
|
||||
expect(extra).not.toHaveProperty('testProfilePath')
|
||||
expect(extra).not.toHaveProperty('color')
|
||||
expect(extra).not.toHaveProperty('autoReview')
|
||||
})
|
||||
})
|
||||
|
||||
describe('todoResetUiPatch', () => {
|
||||
it('用 null 清空 UI 字段,避免 postMessage 丢掉 undefined', () => {
|
||||
expect(todoResetUiPatch()).toEqual({
|
||||
column: 'todo',
|
||||
branch: null,
|
||||
implementStatus: null,
|
||||
pr: null,
|
||||
prMerged: false,
|
||||
prMergedAt: null,
|
||||
worktreePath: null,
|
||||
implementSessionId: null,
|
||||
reviewSessionId: null,
|
||||
worktreeExists: false,
|
||||
})
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user