wip: code formatting nits continued

This commit is contained in:
jdalton
2023-09-16 22:59:56 -07:00
parent 0b28b7f7b6
commit b5c59317ea
421 changed files with 7354 additions and 9005 deletions

View File

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