wip: migrate to bun

This commit is contained in:
jdalton
2023-09-16 14:47:50 -07:00
parent 2da024c3b4
commit 97d4a2fe19
1052 changed files with 30244 additions and 26856 deletions

View File

@@ -0,0 +1,25 @@
import assert from 'node:assert';
import lodashStable from 'lodash';
import { _, MAX_SAFE_INTEGER, MAX_INTEGER } from './utils';
describe('toInteger methods', () => {
lodashStable.each(['toInteger', 'toSafeInteger'], (methodName) => {
const func = _[methodName],
isSafe = methodName == 'toSafeInteger';
it(`\`_.${methodName}\` should convert values to integers`, () => {
assert.strictEqual(func(-5.6), -5);
assert.strictEqual(func('5.6'), 5);
assert.strictEqual(func(), 0);
assert.strictEqual(func(NaN), 0);
const expected = isSafe ? MAX_SAFE_INTEGER : MAX_INTEGER;
assert.strictEqual(func(Infinity), expected);
assert.strictEqual(func(-Infinity), -expected);
});
it(`\`_.${methodName}\` should support \`value\` of \`-0\``, () => {
assert.strictEqual(1 / func(-0), -Infinity);
});
});
});