本仓 2026-08-12 从 ssw main (192.168.1.18:13300/ssw/ssw-mvp) 的 dacli/ subpath 抽取,作为独立仓托管到 gitea:3000/ssw/dacli.git。 - 工作树为 ssw main dacli subpath 最新版 (110 commit, 08-12) - 历史未带 ssw main 整体历史(避免大仓污染) - 此为新仓基线 commit,未来以本仓历史为主
43 lines
1.5 KiB
TypeScript
43 lines
1.5 KiB
TypeScript
/**
|
|
* tests/unit/relation_form_complete_regression.test.ts
|
|
*
|
|
* 回归 BS-新146 同模式 (L4) — relation_form_complete --no-release 选项.
|
|
*
|
|
* 历史 bug: `.option('--no-release', '...', false)` + 源码读 `opts.noRelease`.
|
|
* commander `--no-X` 语义: opts.X 默认 true (走 release), 传 --no-X 时为 false.
|
|
* 显式 default false 会强制把默认改成 false, 传 --no-X 时反而 = true (反转反向, release 永远跑).
|
|
*
|
|
* 修复: Opts.release 字段 + `if (opts.release !== false)` + 移除显式 default.
|
|
*/
|
|
import { describe, expect, it } from 'vitest'
|
|
import { buildFormRelationFormCompleteCommand } from '../../src/commands/form/relation_form_complete.ts'
|
|
|
|
describe('relation_form_complete --no-release 选项 BS-新146 同模式 (L4)', () => {
|
|
it('--no-release 传 → opts.release === false (跳过 release)', async () => {
|
|
const cmd = buildFormRelationFormCompleteCommand()
|
|
try {
|
|
await cmd.parseAsync([
|
|
'--id', 'F1',
|
|
'--no-release',
|
|
], { from: 'user' })
|
|
} catch {
|
|
// ignore action error (mock 缺失)
|
|
}
|
|
const opts = cmd.opts<{ release?: boolean }>()
|
|
expect(opts.release).toBe(false)
|
|
})
|
|
|
|
it('不传 --no-release → opts.release === true (commander 默认, 走 release)', async () => {
|
|
const cmd = buildFormRelationFormCompleteCommand()
|
|
try {
|
|
await cmd.parseAsync([
|
|
'--id', 'F1',
|
|
], { from: 'user' })
|
|
} catch {
|
|
// ignore action error
|
|
}
|
|
const opts = cmd.opts<{ release?: boolean }>()
|
|
expect(opts.release).toBe(true)
|
|
})
|
|
})
|