mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-14 04:37:50 +00:00
Cleanup clone tests.
This commit is contained in:
12
test/test.js
12
test/test.js
@@ -1844,11 +1844,11 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
test('`_.clone` should perform a shallow clone', 2, function() {
|
test('`_.clone` should perform a shallow clone', 2, function() {
|
||||||
var expected = [{ 'a': 0 }, { 'b': 1 }],
|
var array = [{ 'a': 0 }, { 'b': 1 }],
|
||||||
actual = _.clone(expected);
|
actual = _.clone(array);
|
||||||
|
|
||||||
deepEqual(actual, expected);
|
deepEqual(actual, array);
|
||||||
ok(actual !== expected && actual[0] === expected[0]);
|
ok(actual !== array && actual[0] === array[0]);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('`_.clone` should work with `isDeep`', 8, function() {
|
test('`_.clone` should work with `isDeep`', 8, function() {
|
||||||
@@ -1871,8 +1871,8 @@
|
|||||||
object.foo.b.c.d = object;
|
object.foo.b.c.d = object;
|
||||||
object.bar.b = object.foo.b;
|
object.bar.b = object.foo.b;
|
||||||
|
|
||||||
var clone = _.cloneDeep(object);
|
var actual = _.cloneDeep(object);
|
||||||
ok(clone.bar.b === clone.foo.b && clone === clone.foo.b.c.d && clone !== object);
|
ok(actual.bar.b === actual.foo.b && actual === actual.foo.b.c.d && actual !== object);
|
||||||
});
|
});
|
||||||
|
|
||||||
_.each(['clone', 'cloneDeep'], function(methodName) {
|
_.each(['clone', 'cloneDeep'], function(methodName) {
|
||||||
|
|||||||
Reference in New Issue
Block a user