import { describe, expect, it } from 'vitest'; import { Field } from '../../src/domain/field.js'; describe('Field', () => { it('construit avec props minimales', () => { const f = new Field({ id: 1, name: 'titre', type: 'text' }); expect(f.id).toBe(1); expect(f.name).toBe('titre'); expect(f.type).toBe('text'); expect(f.primary).toBe(false); expect(f.options).toBeNull(); }); it('accepte primary + options', () => { const f = new Field({ id: 2, name: 'statut', type: 'single_select', primary: false, options: { select_options: [{ id: 1, value: 'actif' }] }, }); expect(f.primary).toBe(false); expect(f.options).toEqual({ select_options: [{ id: 1, value: 'actif' }] }); }); it('preserve les types non-enum (Baserow expose tout)', () => { const f = new Field({ id: 3, name: 'rollup', type: 'formula' }); expect(f.type).toBe('formula'); }); });