mirror of
https://github.com/dzeiocom/libs.git
synced 2025-06-20 22:49:19 +00:00
Moved deprecated tests to a new file
Signed-off-by: Florian BOUILLON <florian.bouillon@delta-wings.net>
This commit is contained in:
37
packages/object-util/__tests__/deprecated.test.ts
Normal file
37
packages/object-util/__tests__/deprecated.test.ts
Normal file
@ -0,0 +1,37 @@
|
||||
/// <reference types="jest" />
|
||||
|
||||
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)
|
||||
})
|
||||
})
|
Reference in New Issue
Block a user