mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 06:27:49 +00:00
* test: fix throttle.spec.js Signed-off-by: tison <wander4096@gmail.com> * test: fix pickBy.spec.js Signed-off-by: tison <wander4096@gmail.com> * test: fix isBuffer.spec.js Signed-off-by: tison <wander4096@gmail.com> * test: partially fix attempt.spec.js Signed-off-by: tison <wander4096@gmail.com> * test: partially fix dropRightWhile.spec.js Signed-off-by: tison <wander4096@gmail.com> * test: fix defer.spec.js and rest.spec.js Signed-off-by: tison <wander4096@gmail.com> * test: fix invoke.spec.js Signed-off-by: tison <wander4096@gmail.com> * test: fix isArray.spec.js Signed-off-by: tison <wander4096@gmail.com> * test: partially fix iteration-methods.spec.js Signed-off-by: tison <wander4096@gmail.com> * test: fix xor-methods.spec.js Signed-off-by: tison <wander4096@gmail.com> * test: fix property.spec.js Signed-off-by: tison <wander4096@gmail.com> * test: fix ary.spec.js Signed-off-by: tison <wander4096@gmail.com> * test: fix omit-methods.spec.js Signed-off-by: tison <wander4096@gmail.com> * test: fix debounce-and-throttle.spec.js Signed-off-by: tison <wander4096@gmail.com> * test: fix unzip-and-zip.spec.js Signed-off-by: tison <wander4096@gmail.com> * test: fix toPairs-methods.spec.js Signed-off-by: tison <wander4096@gmail.com> * test: fix exit-early.spec.js Signed-off-by: tison <wander4096@gmail.com> * test: temporarily comment out takeWhile and dropWhile tests Signed-off-by: tison <wander4096@gmail.com> * test: partially fix union*.spec.js Signed-off-by: tison <wander4096@gmail.com> * test: fix startsWith-and-endsWith.spec.js Signed-off-by: tison <wander4096@gmail.com> * test: fix isNil.spec.js Signed-off-by: tison <wander4096@gmail.com> * test: fix some of syntax errors Signed-off-by: tison <wander4096@gmail.com> --------- Signed-off-by: tison <wander4096@gmail.com>
36 lines
1.1 KiB
JavaScript
36 lines
1.1 KiB
JavaScript
import lodashStable, { isArray } from 'lodash';
|
|
import { falsey, stubFalse, args, slice, symbol, realm } from './utils';
|
|
|
|
describe('isArray', () => {
|
|
it('should return `true` for arrays', () => {
|
|
expect(isArray([1, 2, 3])).toBe(true);
|
|
});
|
|
|
|
it('should return `false` for non-arrays', () => {
|
|
const expected = lodashStable.map(falsey, stubFalse);
|
|
|
|
const actual = lodashStable.map(falsey, (value, index) =>
|
|
index ? isArray(value) : isArray(),
|
|
);
|
|
|
|
expect(actual).toEqual(expected);
|
|
|
|
expect(isArray(args)).toBe(false);
|
|
expect(isArray(true)).toBe(false);
|
|
expect(isArray(new Date())).toBe(false);
|
|
expect(isArray(new Error())).toBe(false);
|
|
expect(isArray(slice)).toBe(false);
|
|
expect(isArray({ 0: 1, length: 1 })).toBe(false);
|
|
expect(isArray(1)).toBe(false);
|
|
expect(isArray(/x/)).toBe(false);
|
|
expect(isArray('a')).toBe(false);
|
|
expect(isArray(symbol)).toBe(false);
|
|
});
|
|
|
|
it('should work with an array from another realm', () => {
|
|
if (realm.array) {
|
|
expect(isArray(realm.array)).toBe(true);
|
|
}
|
|
});
|
|
});
|