Files
dacli/tests/unit/form_create_smartprops_ai.test.ts
sushub f403a7e80e import: ssw/dacli@eea0ebc (2026-08-12) 起点版本
本仓 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,未来以本仓历史为主
2026-08-12 15:58:06 +08:00

25 lines
1.0 KiB
TypeScript

import { describe, expect, it } from 'vitest'
import { shouldRunFinalSmartProps } from '../../src/commands/form/create.ts'
function withBuild(opts: Record<string, unknown>) {
return { ...opts, __aiBuildFormData: { formData: '{}' } }
}
describe('form create final smartProps gate', () => {
it('runs when --ai supplies a form data builder', () => {
expect(shouldRunFinalSmartProps(withBuild({ ai: 'demo' }))).toBe(true)
})
it('runs when --table supplies a form data builder', () => {
expect(shouldRunFinalSmartProps(withBuild({ table: 'x' }))).toBe(true)
})
it('runs when both --ai and --table are present', () => {
expect(shouldRunFinalSmartProps(withBuild({ ai: 'demo', table: 'x' }))).toBe(true)
})
it('does not run when neither --ai nor --table is set (defensive)', () => {
expect(shouldRunFinalSmartProps({} as any)).toBe(false)
})
it('does not run when --ai is set but no builder output is attached', () => {
expect(shouldRunFinalSmartProps({ ai: 'demo' } as any)).toBe(false)
})
})