mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 06:27:49 +00:00
46 lines
1.1 KiB
TypeScript
46 lines
1.1 KiB
TypeScript
import assert from 'node:assert';
|
|
import lodashStable from 'lodash';
|
|
|
|
describe('lodash(...) methods that return new wrapped values', () => {
|
|
const funcs = [
|
|
'castArray',
|
|
'concat',
|
|
'difference',
|
|
'differenceBy',
|
|
'differenceWith',
|
|
'intersection',
|
|
'intersectionBy',
|
|
'intersectionWith',
|
|
'pull',
|
|
'pullAll',
|
|
'pullAt',
|
|
'sampleSize',
|
|
'shuffle',
|
|
'slice',
|
|
'splice',
|
|
'split',
|
|
'toArray',
|
|
'union',
|
|
'unionBy',
|
|
'unionWith',
|
|
'uniq',
|
|
'uniqBy',
|
|
'uniqWith',
|
|
'words',
|
|
'xor',
|
|
'xorBy',
|
|
'xorWith',
|
|
];
|
|
|
|
lodashStable.each(funcs, (methodName) => {
|
|
it(`\`_(...).${methodName}\` should return a new wrapped value`, () => {
|
|
const value = methodName === 'split' ? 'abc' : [1, 2, 3],
|
|
wrapped = _(value),
|
|
actual = wrapped[methodName]();
|
|
|
|
assert.ok(actual instanceof _);
|
|
assert.notStrictEqual(actual, wrapped);
|
|
});
|
|
});
|
|
});
|