forked from lodash/lodash
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcastArray.test.js
More file actions
23 lines (19 loc) · 758 Bytes
/
castArray.test.js
File metadata and controls
23 lines (19 loc) · 758 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import assert from 'assert';
import lodashStable from 'lodash';
import { falsey } from './utils.js';
import castArray from '../castArray.js';
describe('castArray', function() {
it('should wrap non-array items in an array', function() {
var values = falsey.concat(true, 1, 'a', { 'a': 1 }),
expected = lodashStable.map(values, function(value) { return [value]; }),
actual = lodashStable.map(values, castArray);
assert.deepStrictEqual(actual, expected);
});
it('should return array values by reference', function() {
var array = [1];
assert.strictEqual(castArray(array), array);
});
it('should return an empty array when no arguments are given', function() {
assert.deepStrictEqual(castArray(), []);
});
});