Open History to see the last commit
1import { describe, expect, it } from 'vitest'
2import { FormApi, formOptions } from '../src/index'
3β
4describe('formOptions', () => {
5 it('should allow default values to be set', async () => {
6 type Person = {
7 firstName: string
8 lastName: string
9 }
10β
11 const formOpts = formOptions<Person>({
12 defaultValues: {
13 firstName: 'FirstName',
14 lastName: 'LastName',
15 },
16 })
17β
18 const form = new FormApi({
19 ...formOpts,
20 })
21β
22 expect(form.state.values['firstName']).toBe('FirstName')
23 expect(form.state.values['lastName']).toBe('LastName')
24 })
25})