Update snippet, add extra tests

This commit is contained in:
Angelos Chalaris
2019-09-28 13:35:11 +03:00
parent 6c00c38a61
commit f859b78b7d
7 changed files with 46 additions and 44 deletions

View File

@ -10,7 +10,8 @@ const data = {
d: {},
e: { a: 'a', b: 'b', c: 'c', d: ['a', 'b', 'c'] },
f: 1,
g: true
g: true,
h: null
};
const dupe = deepClone(data);
test('Shallow cloning works', () => {
@ -33,3 +34,6 @@ test('Cloning primitives works', () => {
expect(data.f).toBe(dupe.f);
expect(data.g).toBe(dupe.g);
});
test('Cloning null works', () => {
expect(data.h).toBe(dupe.h);
});