mirror of
https://github.com/dzeiocom/libs.git
synced 2025-04-22 10:52:11 +00:00
Some checks failed
CodeQL / Analyze (javascript) (push) Failing after 54s
Signed-off-by: Florian BOUILLON <f.bouillon@aptatio.com>
41 lines
892 B
TypeScript
41 lines
892 B
TypeScript
/// <reference types="jest" />
|
|
/**
|
|
* Tests for currently deprecated functions, so that there works die only after the next major update
|
|
*/
|
|
|
|
import { cloneObject, objectToArray } from "../src/ObjectUtil"
|
|
|
|
describe('Object To Array Tests', () => {
|
|
it('Should Works', () => {
|
|
const obj = {
|
|
pouet: 'first',
|
|
toto: 'second'
|
|
}
|
|
expect(objectToArray(obj)).toEqual(['first', 'second'])
|
|
})
|
|
})
|
|
|
|
describe('Object Clone Tests', () => {
|
|
it('should clone the object', () => {
|
|
const obj = {
|
|
pouet: 'first',
|
|
toto: 'second'
|
|
}
|
|
const clone = cloneObject(obj)
|
|
expect(clone).toEqual(obj)
|
|
clone.pouet = 'third'
|
|
expect(clone).not.toEqual(obj)
|
|
})
|
|
|
|
it('should deeply clone the object', () => {
|
|
const obj = {
|
|
pouet: {is: 'first'},
|
|
toto: 'second'
|
|
}
|
|
const clone = cloneObject(obj)
|
|
expect(clone).toEqual(obj)
|
|
clone.toto = 'third'
|
|
expect(clone).not.toEqual(obj)
|
|
})
|
|
})
|