Skip to content

Commit

Permalink
tests(shallow): Compare functions test was added (pmndrs#1071)
Browse files Browse the repository at this point in the history
* feat: compare functions test was added

* run prettier to formate code
  • Loading branch information
tbor00 authored Jul 11, 2022
1 parent 74de9eb commit f949d04
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/shallow.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,20 @@ describe('shallow', () => {

expect(shallow([{ foo: 'bar' }], [{ foo: 'bar', asd: 123 }])).toBe(false)
})

it('compares functions', () => {
function firstFnCompare() {
return { foo: 'bar' }
}

function secondFnCompare() {
return { foo: 'bar' }
}

expect(shallow(firstFnCompare, firstFnCompare)).toBe(true)

expect(shallow(secondFnCompare, secondFnCompare)).toBe(true)

expect(shallow(firstFnCompare, secondFnCompare)).toBe(false)
})
})

0 comments on commit f949d04

Please sign in to comment.