From 7e0980256577ea0dbb28c483027c2b691f99d211 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Tue, 6 Oct 2015 19:52:25 -0700 Subject: [PATCH] Reorganize clone tests. --- test/test.js | 80 ++++++++++++++++++++++++++-------------------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/test/test.js b/test/test.js index d3aca788a..b48e4ca8e 100644 --- a/test/test.js +++ b/test/test.js @@ -2141,21 +2141,6 @@ }); }); - _.forOwn(uncloneable, function(value, key) { - QUnit.test('`_.' + methodName + '` should not clone ' + key, function(assert) { - assert.expect(3); - - var object = { 'a': value, 'b': { 'c': value } }, - actual = func(object); - - assert.deepEqual(actual, object); - assert.notStrictEqual(actual, object); - - var expected = typeof value == 'function' ? { 'c': Foo.c } : (value && {}); - assert.deepEqual(func(value), expected); - }); - }); - QUnit.test('`_.' + methodName + '` should clone array buffers', function(assert) { assert.expect(2); @@ -2171,31 +2156,6 @@ } }); - _.each(typedArrays, function(type) { - QUnit.test('`_.' + methodName + '` should clone ' + type + ' arrays', function(assert) { - assert.expect(10); - - var Ctor = root[type]; - - _.times(2, function(index) { - if (Ctor) { - var buffer = new ArrayBuffer(24), - array = index ? new Ctor(buffer, 8, 1) : new Ctor(buffer), - actual = func(array); - - assert.deepEqual(actual, array); - assert.notStrictEqual(actual, array); - assert.strictEqual(actual.buffer === array.buffer, !isDeep); - assert.strictEqual(actual.byteOffset, array.byteOffset); - assert.strictEqual(actual.length, array.length); - } - else { - skipTest(assert, 5); - } - }); - }); - }); - QUnit.test('`_.' + methodName + '` should clone `index` and `input` array properties', function(assert) { assert.expect(2); @@ -2287,6 +2247,46 @@ skipTest(assert, 2); } }); + + _.each(typedArrays, function(type) { + QUnit.test('`_.' + methodName + '` should clone ' + type + ' arrays', function(assert) { + assert.expect(10); + + var Ctor = root[type]; + + _.times(2, function(index) { + if (Ctor) { + var buffer = new ArrayBuffer(24), + array = index ? new Ctor(buffer, 8, 1) : new Ctor(buffer), + actual = func(array); + + assert.deepEqual(actual, array); + assert.notStrictEqual(actual, array); + assert.strictEqual(actual.buffer === array.buffer, !isDeep); + assert.strictEqual(actual.byteOffset, array.byteOffset); + assert.strictEqual(actual.length, array.length); + } + else { + skipTest(assert, 5); + } + }); + }); + }); + + _.forOwn(uncloneable, function(value, key) { + QUnit.test('`_.' + methodName + '` should not clone ' + key, function(assert) { + assert.expect(3); + + var object = { 'a': value, 'b': { 'c': value } }, + actual = func(object); + + assert.deepEqual(actual, object); + assert.notStrictEqual(actual, object); + + var expected = typeof value == 'function' ? { 'c': Foo.c } : (value && {}); + assert.deepEqual(func(value), expected); + }); + }); }); _.each(['cloneWith', 'cloneDeepWith'], function(methodName) {