safer test on copy_object
This commit is contained in:
parent
c5aef0a81e
commit
d8ee6074fa
@ -33,5 +33,8 @@
|
||||
"LICENSE",
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
]
|
||||
}
|
||||
],
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
}
|
||||
}
|
||||
|
@ -34,11 +34,15 @@ test ('try_parse_json should fail', (t) => {
|
||||
});
|
||||
|
||||
test ('copy object', (t) => {
|
||||
const obj = { foo: 'bar' };
|
||||
const obj = { foo: 'bar', bar: { foo: 'baz' } };
|
||||
const copy = util.copy_object (obj);
|
||||
t.deepEqual (obj, copy);
|
||||
copy.foo = 'baz';
|
||||
copy.bar.foo = 'bar';
|
||||
t.is (copy.foo, 'baz');
|
||||
t.is (copy.bar.foo, 'bar');
|
||||
t.is (obj.foo, 'bar');
|
||||
t.is (obj.bar.foo, 'baz');
|
||||
});
|
||||
|
||||
test ('run regex', (t) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user