mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-23 08:45:50 +00:00
fix(effort): 测试里 cursor cast 为 EffortValue,避免 PanelPosition 含 ultracode 触发 TS 错误
computeConfirmOutcome 的 ApplyFn 契约要求 EffortValue,但测试 mockApply 接收 PanelPosition。 实际运行时 computeConfirmOutcome 在 ultracode 档位走 hint 分支不会调 applyFn, cast 安全。precheck 全量通过:5688 tests / 0 fail。 Co-Authored-By: glm-5.2 <zai-org@claude-code-best.win>
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import { describe, expect, test } from 'bun:test'
|
import { describe, expect, test } from 'bun:test'
|
||||||
|
import type { EffortValue } from '../../../utils/effort.js'
|
||||||
import {
|
import {
|
||||||
CANCEL_MESSAGE,
|
CANCEL_MESSAGE,
|
||||||
type ApplyFn,
|
type ApplyFn,
|
||||||
@@ -107,7 +108,10 @@ describe('effortPanelState', () => {
|
|||||||
describe('computeConfirmOutcome', () => {
|
describe('computeConfirmOutcome', () => {
|
||||||
const mockApply: ApplyFn = cursor => ({
|
const mockApply: ApplyFn = cursor => ({
|
||||||
message: `applied:${cursor}`,
|
message: `applied:${cursor}`,
|
||||||
effortUpdate: { value: cursor },
|
// 测试里 cursor 是 PanelPosition(含 ultracode),但 ApplyFn 的契约要求 EffortValue。
|
||||||
|
// 实际运行时 mockApply 只会被 computeConfirmOutcome 在非 ultracode 档位调用,
|
||||||
|
// 因此 cast 是安全的。生产代码用真 executeEffort 不会出现 ultracode。
|
||||||
|
effortUpdate: { value: cursor as unknown as EffortValue },
|
||||||
})
|
})
|
||||||
|
|
||||||
test('ultracode → kind=ultracode-hint,含 /ultracode 引导', () => {
|
test('ultracode → kind=ultracode-hint,含 /ultracode 引导', () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user