Skip to content

Commit e74ef29

Browse files
committed
chore: bump deps and move tests
1 parent 603a258 commit e74ef29

File tree

5 files changed

+533
-371
lines changed

5 files changed

+533
-371
lines changed

examples/react/remix/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"_test:types": "tsc"
99
},
1010
"dependencies": {
11-
"@remix-run/node": "^2.15.0",
11+
"@remix-run/node": "^2.15.3",
1212
"@remix-run/react": "^2.15.0",
1313
"@remix-run/serve": "^2.15.0",
1414
"@tanstack/react-form": "^0.42.0",

packages/form-core/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@tanstack/form-core",
3-
"version": "0.42.1",
3+
"version": "0.42.0",
44
"description": "Powerful, type-safe, framework agnostic forms.",
55
"author": "tannerlinsley",
66
"license": "MIT",

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

+49
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,53 @@ describe('mutateMergeDeep', () => {
4848
expect(target.user.details).toBe(originalDetails)
4949
expect(target.user.details.name).toBe('test')
5050
})
51+
52+
it('Should merge two objects by mutating', () => {
53+
const a = { a: 1 }
54+
const b = { b: 2 }
55+
mutateMergeDeep(a, b)
56+
expect(a).toStrictEqual({ a: 1, b: 2 })
57+
})
58+
59+
it('Should merge two objects including overwriting with undefined', () => {
60+
const a = { a: 1 }
61+
const b = { a: undefined }
62+
mutateMergeDeep(a, b)
63+
expect(a).toStrictEqual({ a: undefined })
64+
})
65+
66+
it('Should merge two object by overriding arrays', () => {
67+
const target = { a: [1] }
68+
const source = { a: [2] }
69+
mutateMergeDeep(target, source)
70+
expect(target).toStrictEqual({ a: [2] })
71+
})
72+
73+
it('Should merge add array element when it does not exist in target', () => {
74+
const target = { a: [] }
75+
const source = { a: [2] }
76+
mutateMergeDeep(target, source)
77+
expect(target).toStrictEqual({ a: [2] })
78+
})
79+
80+
it('Should override the target array if source is undefined', () => {
81+
const target = { a: [2] }
82+
const source = { a: undefined }
83+
mutateMergeDeep(target, source)
84+
expect(target).toStrictEqual({ a: undefined })
85+
})
86+
87+
it('Should merge update array element when it does not exist in source', () => {
88+
const target = { a: [2] }
89+
const source = { a: [] }
90+
mutateMergeDeep(target, source)
91+
expect(target).toStrictEqual({ a: [] })
92+
})
93+
94+
it('Should merge two deeply nested objects', () => {
95+
const a = { a: { a: 1 } }
96+
const b = { a: { b: 2 } }
97+
mutateMergeDeep(a, b)
98+
expect(a).toStrictEqual({ a: { a: 1, b: 2 } })
99+
})
51100
})

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

-53
This file was deleted.

0 commit comments

Comments
 (0)