1
0
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:
Florian Bouillon 2023-03-14 11:00:49 +01:00
parent 446355b451
commit cfbc85580c
Signed by: Florian Bouillon
GPG Key ID: E05B3A94178D3A7C

View File

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