add default value test for normal fields

This commit is contained in:
Elliot DeNolf
2020-10-08 10:16:05 -04:00
parent ddb238c7e4
commit 40afb5e8fa

View File

@@ -0,0 +1,17 @@
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);
});
});