From dc77d7605d05bbda9a46f14da4408e0f745385d8 Mon Sep 17 00:00:00 2001 From: John-David Dalton Date: Sun, 24 Apr 2016 23:56:22 -0700 Subject: [PATCH] Add `_.toArray` tests for maps. --- test/test.js | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/test/test.js b/test/test.js index af1b71ff3..679e1bf46 100644 --- a/test/test.js +++ b/test/test.js @@ -22784,14 +22784,6 @@ assert.deepEqual(_.toArray({ 'a': 1, 'b': 2 }), [1, 2]); }); - QUnit.test('should convert strings to arrays', function(assert) { - assert.expect(3); - - assert.deepEqual(_.toArray(''), []); - assert.deepEqual(_.toArray('ab'), ['a', 'b']); - assert.deepEqual(_.toArray(Object('ab')), ['a', 'b']); - }); - QUnit.test('should convert iterables to arrays', function(assert) { assert.expect(1); @@ -22806,6 +22798,28 @@ } }); + QUnit.test('should convert maps to arrays', function(assert) { + assert.expect(1); + + if (Map) { + var map = new Map; + map.set('a', 1); + map.set('b', 2); + assert.deepEqual(_.toArray(map), [['a', 1], ['b', 2]]); + } + else { + skipAssert(assert); + } + }); + + QUnit.test('should convert strings to arrays', function(assert) { + assert.expect(3); + + assert.deepEqual(_.toArray(''), []); + assert.deepEqual(_.toArray('ab'), ['a', 'b']); + assert.deepEqual(_.toArray(Object('ab')), ['a', 'b']); + }); + QUnit.test('should work in a lazy sequence', function(assert) { assert.expect(2);