import { describe, expect, it } from 'vitest' import { pickChoiceValue } from '../../src/commands/test/run.ts' describe('test run pickChoiceValue', () => { it('returns first option value when no dictionary binding exists', async () => { const value = await pickChoiceValue( {} as any, new Map(), { options: [{ value: 'finance' }] }, 'f_topic_direction', ) expect(value).toBe('finance') }) it('falls back to "1" when both options and dictionary are missing', async () => { const value = await pickChoiceValue( {} as any, new Map(), {}, 'f_topic_direction', ) expect(value).toBe('1') }) it('returns cached dictionary enCode on subsequent calls', async () => { const cache = new Map>>([ ['dict-id', [{ enCode: 'pending' }, { enCode: 'approved' }]], ]) const value = await pickChoiceValue( {} as any, cache, { dataType: 'dictionary', dictionaryType: 'dict-id' }, 'f_registration_status', ) expect(value).toBe('pending') }) })