Skip to content

Commit

Permalink
chore: add test
Browse files Browse the repository at this point in the history
  • Loading branch information
nytamin committed Oct 20, 2023
1 parent e16c389 commit dbc760e
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions apps/app/src/lib/__tests__/util.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,69 @@ test('deepExtendRemovingUndefined', () => {
})
expect(target).toStrictEqual({ a: [4, 5, 6] })
}

{
const target = {
arr: [1, 2, 3],
obj: {
num: 1,
arr: [
{
a: 1,
},
{
b: 2,
},
],
obj: {
a: 1,
},
toBeUndefined: {
a: 1,
},
},
}
deepExtendRemovingUndefined(target, {
arr: [3, 4, 5],
obj: {
num: 2,
arr: [
{
a: 2,
},
{
b: 3,
},
{
c: 4,
},
],
obj: {
b: 2,
},
toBeUndefined: undefined,
},
})
expect(target).toStrictEqual({
arr: [3, 4, 5],
obj: {
num: 2,
arr: [
{
a: 2,
},
{
b: 3,
},
{
c: 4,
},
],
obj: {
a: 1,
b: 2,
},
},
})
}
})

0 comments on commit dbc760e

Please sign in to comment.