import { describe, expect, it } from 'vitest' import { shouldRunFinalSmartProps } from '../../src/commands/form/create.ts' function withBuild(opts: Record) { 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) }) })