mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-07 18:07:49 +00:00
wip: migrate to bun
This commit is contained in:
30
test/tap.spec.ts
Normal file
30
test/tap.spec.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import assert from 'node:assert';
|
||||
|
||||
describe('tap', () => {
|
||||
it('should intercept and return the given value', () => {
|
||||
let intercepted,
|
||||
array = [1, 2, 3];
|
||||
|
||||
const actual = _.tap(array, (value) => {
|
||||
intercepted = value;
|
||||
});
|
||||
|
||||
assert.strictEqual(actual, array);
|
||||
assert.strictEqual(intercepted, array);
|
||||
});
|
||||
|
||||
it('should intercept unwrapped values and return wrapped values when chaining', () => {
|
||||
let intercepted,
|
||||
array = [1, 2, 3];
|
||||
|
||||
const wrapped = _(array).tap((value) => {
|
||||
intercepted = value;
|
||||
value.pop();
|
||||
});
|
||||
|
||||
assert.ok(wrapped instanceof _);
|
||||
|
||||
wrapped.value();
|
||||
assert.strictEqual(intercepted, array);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user