mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-07 01:57:50 +00:00
wip: migrate to bun
This commit is contained in:
27
test/lodash(...).unshift.spec.ts
Normal file
27
test/lodash(...).unshift.spec.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import assert from 'node:assert';
|
||||
import lodashStable from 'lodash';
|
||||
import { falsey, stubTrue } from './utils';
|
||||
|
||||
describe('lodash(...).unshift', () => {
|
||||
it('should prepend elements to `array`', () => {
|
||||
const array = [3],
|
||||
wrapped = _(array).unshift(1, 2),
|
||||
actual = wrapped.value();
|
||||
|
||||
assert.strictEqual(actual, array);
|
||||
assert.deepEqual(actual, [1, 2, 3]);
|
||||
});
|
||||
|
||||
it('should accept falsey arguments', () => {
|
||||
const expected = lodashStable.map(falsey, stubTrue);
|
||||
|
||||
const actual = lodashStable.map(falsey, (value, index) => {
|
||||
try {
|
||||
const result = index ? _(value).unshift(1).value() : _().unshift(1).value();
|
||||
return lodashStable.eq(result, value);
|
||||
} catch (e) {}
|
||||
});
|
||||
|
||||
assert.deepEqual(actual, expected);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user