import { describe, expect, it } from 'vitest'; import { Field } from '../../src/domain/field.js'; import { Table } from '../../src/domain/table.js'; describe('Table', () => { it('construit avec props minimales', () => { const t = new Table({ id: 1, name: 'Personne', databaseId: 5 }); expect(t.id).toBe(1); expect(t.name).toBe('Personne'); expect(t.databaseId).toBe(5); expect(t.fields).toEqual([]); expect(t.orderIndex).toBe(0); }); it('accepte fields + orderIndex', () => { const f = new Field({ id: 10, name: 'nom', type: 'text', primary: true }); const t = new Table({ id: 2, name: 'Bloc', databaseId: 5, fields: [f], orderIndex: 3, }); expect(t.fields).toHaveLength(1); expect(t.fields[0]?.name).toBe('nom'); expect(t.orderIndex).toBe(3); }); });