Files
payload/src/admin/components/forms/Form/buildStateFromSchema.spec.js
2022-03-28 12:58:39 -04:00

18 lines
467 B
JavaScript

import buildStateFromSchema from './buildStateFromSchema';
describe('Form - buildStateFromSchema', () => {
it('populates default value - normal fields', async () => {
const defaultValue = 'Default';
const fieldSchema = [
{
name: 'text',
type: 'text',
label: 'Text',
defaultValue,
},
];
const state = await buildStateFromSchema({ fieldSchema });
expect(state.text.value).toBe(defaultValue);
});
});