mirror of
https://github.com/pmndrs/zustand.git
synced 2025-12-08 19:45:52 +00:00
tests(shallow): Compare functions test was added (#1071)
* feat: compare functions test was added * run prettier to formate code
This commit is contained in:
parent
74de9eb6ba
commit
f949d04ff2
@ -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)
|
||||
})
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user