Skip to content

Commit

Permalink
Add test cases for the $invert function
Browse files Browse the repository at this point in the history
Signed-off-by: Axel Boberg <[email protected]>
  • Loading branch information
axelboberg committed Feb 29, 2024
1 parent dcbb585 commit 8d6fcb2
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions shared/merge.unit.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,25 @@ test('replace array values', () => {

expect(merge.deep(source, apply)[1]).toEqual(apply[1])
})

test('invert boolean value', () => {
const source = {
myBoolean: false
}

const apply = {
myBoolean: { $invert: true }
}
expect(merge.deep(source, apply).myBoolean).toEqual(true)
})

test('invert string value', () => {
const source = {
myBoolean: 'false'
}

const apply = {
myBoolean: { $invert: true }
}
expect(merge.deep(source, apply).myBoolean).toEqual(false)
})

0 comments on commit 8d6fcb2

Please sign in to comment.