mirror of
https://github.com/dzeiocom/libs.git
synced 2025-04-22 10:52:11 +00:00
fix: Test for deep clone when option is manually set
Signed-off-by: Avior <f.bouillon@aptatio.com>
This commit is contained in:
parent
446355b451
commit
cfbc85580c
@ -214,6 +214,17 @@ describe('Object Clone Tests', () => {
|
|||||||
expect(clone).not.toEqual(obj)
|
expect(clone).not.toEqual(obj)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('should deeply clone the object when option is set', () => {
|
||||||
|
const obj = {
|
||||||
|
pouet: {is: 'first'},
|
||||||
|
toto: 'second'
|
||||||
|
}
|
||||||
|
const clone = objectClone(obj, {deep: true})
|
||||||
|
expect(clone).toEqual(obj)
|
||||||
|
clone.toto = 'third'
|
||||||
|
expect(clone).not.toEqual(obj)
|
||||||
|
})
|
||||||
|
|
||||||
it('should clone an Array', () => {
|
it('should clone an Array', () => {
|
||||||
const obj = ['one', 'two']
|
const obj = ['one', 'two']
|
||||||
const clone = objectClone(obj)
|
const clone = objectClone(obj)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user