1
0
mirror of https://github.com/dzeiocom/libs.git synced 2025-04-22 10:52:11 +00:00

Moved deprecated tests to a new file

Signed-off-by: Florian BOUILLON <florian.bouillon@delta-wings.net>
This commit is contained in:
Florian Bouillon 2021-05-21 16:21:52 +02:00
parent 332a821f2f
commit 73ac335ea8
2 changed files with 41 additions and 4 deletions

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

View File

@ -1,6 +1,6 @@
/// <reference types="jest" /> /// <reference types="jest" />
import { objectSize, objectToArray, objectMap, objectSort, cloneObject, objectEqual, objectKeys, objectSet, objectLoop, objectClone } from '../src/ObjectUtil' import { objectSize, objectMap, objectSort, objectEqual, objectKeys, objectSet, objectLoop, objectClone, objectValues } from '../src/ObjectUtil'
describe('Object Map tests', () => { describe('Object Map tests', () => {
it('should works', () => { it('should works', () => {
@ -38,7 +38,7 @@ describe('Object To Array Tests', () => {
pouet: 'first', pouet: 'first',
toto: 'second' toto: 'second'
} }
expect(objectToArray(obj)).toEqual(['first', 'second']) expect(objectValues(obj)).toEqual(['first', 'second'])
}) })
}) })
@ -119,7 +119,7 @@ describe('Object Clone Tests', () => {
pouet: 'first', pouet: 'first',
toto: 'second' toto: 'second'
} }
const clone = cloneObject(obj) const clone = objectClone(obj)
expect(clone).toEqual(obj) expect(clone).toEqual(obj)
clone.pouet = 'third' clone.pouet = 'third'
expect(clone).not.toEqual(obj) expect(clone).not.toEqual(obj)
@ -130,7 +130,7 @@ describe('Object Clone Tests', () => {
pouet: {is: 'first'}, pouet: {is: 'first'},
toto: 'second' toto: 'second'
} }
const clone = cloneObject(obj) const clone = objectClone(obj)
expect(clone).toEqual(obj) expect(clone).toEqual(obj)
clone.toto = 'third' clone.toto = 'third'
expect(clone).not.toEqual(obj) expect(clone).not.toEqual(obj)