Add _.toArray tests for maps.

This commit is contained in:
John-David Dalton
2016-04-24 23:56:22 -07:00
parent f7c4410f41
commit dc77d7605d

View File

@@ -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);