tests(shallow): Compare functions test was added (#1071)

* feat: compare functions test was added

* run prettier to formate code
This commit is contained in:
Timoteo 2022-07-11 00:20:43 -03:00 committed by GitHub
parent 74de9eb6ba
commit f949d04ff2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)
})
})