Skip to content

Commit f670c51

Browse files
committed
chore: fix wrong merge resolution
1 parent 1442f51 commit f670c51

File tree

1 file changed

+40
-39
lines changed

1 file changed

+40
-39
lines changed

packages/form-core/tests/FieldApi.spec.ts

Lines changed: 40 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2872,56 +2872,57 @@ describe('field api', () => {
28722872
vi.useRealTimers()
28732873
})
28742874
})
2875+
})
28752876

2876-
describe('edge cases and error handling', () => {
2877-
it('should handle deleteField on non-existent fields gracefully', () => {
2878-
const form = new FormApi({
2879-
defaultValues: {
2880-
existingField: 'value',
2881-
},
2882-
})
2877+
describe('edge cases and error handling', () => {
2878+
it('should handle deleteField on non-existent fields gracefully', () => {
2879+
const form = new FormApi({
2880+
defaultValues: {
2881+
existingField: 'value',
2882+
},
2883+
})
28832884

2884-
form.mount()
2885+
form.mount()
28852886

2886-
expect(() => {
2887-
form.deleteField('nonExistentField' as keyof typeof form.state.values)
2888-
}).not.toThrow()
2887+
expect(() => {
2888+
form.deleteField('nonExistentField' as keyof typeof form.state.values)
2889+
}).not.toThrow()
28892890

2890-
expect(form.state.values.existingField).toBe('value')
2891-
})
2891+
expect(form.state.values.existingField).toBe('value')
2892+
})
28922893

2893-
it('should handle concurrent field operations correctly', async () => {
2894-
const form = new FormApi({
2895-
defaultValues: {
2896-
field1: 'value1',
2897-
field2: 'value2',
2898-
field3: 'value3',
2899-
},
2900-
})
2894+
it('should handle concurrent field operations correctly', async () => {
2895+
const form = new FormApi({
2896+
defaultValues: {
2897+
field1: 'value1',
2898+
field2: 'value2',
2899+
field3: 'value3',
2900+
},
2901+
})
29012902

2902-
form.mount()
2903+
form.mount()
29032904

2904-
const field1 = new FieldApi({ form, name: 'field1' })
2905-
const field2 = new FieldApi({ form, name: 'field2' })
2906-
const field3 = new FieldApi({ form, name: 'field3' })
2905+
const field1 = new FieldApi({ form, name: 'field1' })
2906+
const field2 = new FieldApi({ form, name: 'field2' })
2907+
const field3 = new FieldApi({ form, name: 'field3' })
29072908

2908-
field1.mount()
2909-
field2.mount()
2910-
field3.mount()
2909+
field1.mount()
2910+
field2.mount()
2911+
field3.mount()
29112912

2912-
const operations = [
2913-
() => form.deleteField('field1'),
2914-
() => form.deleteField('field2'),
2915-
() => form.setFieldValue('field3', 'new value'),
2916-
]
2913+
const operations = [
2914+
() => form.deleteField('field1'),
2915+
() => form.deleteField('field2'),
2916+
() => form.setFieldValue('field3', 'new value'),
2917+
]
29172918

2918-
await Promise.all(operations.map((op) => Promise.resolve(op())))
2919+
await Promise.all(operations.map((op) => Promise.resolve(op())))
29192920

2920-
expect(form.fieldInfo.field1).toBeUndefined()
2921-
expect(form.fieldInfo.field2).toBeUndefined()
2922-
expect(form.fieldInfo.field3).toBeDefined()
2923-
expect(form.state.values.field3).toBe('new value')
2924-
})
2921+
expect(form.fieldInfo.field1).toBeUndefined()
2922+
expect(form.fieldInfo.field2).toBeUndefined()
2923+
expect(form.fieldInfo.field3).toBeDefined()
2924+
expect(form.state.values.field3).toBe('new value')
2925+
})
29252926
it('should allow setting to explicitly undefined', () => {
29262927
const form = new FormApi({
29272928
defaultValues: { a: '' as string | undefined },

0 commit comments

Comments
 (0)