import { stringArrayField } from './stringArray' describe('stringArrayField', () => { it('should build an optional, non-localized array of { value } rows by default', () => { const field = stringArrayField('paragraphs', 'Paragraphs') expect(field).toMatchObject({ name: 'paragraphs', type: 'array', label: 'Paragraphs', required: false }) expect(field).not.toHaveProperty('localized') expect(field.fields).toEqual([{ name: 'value', type: 'text', required: true }]) }) it('should localize the array itself, not the inner value, when localized is set', () => { const field = stringArrayField('paragraphs', 'Paragraphs', { localized: true }) expect(field.localized).toBe(true) expect(field.fields[0]).not.toHaveProperty('localized') }) it('should pass the required flag through', () => { expect(stringArrayField('items', undefined, { required: true }).required).toBe(true) }) })