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

21
test/toLength.spec.js Normal file
View File

@@ -0,0 +1,21 @@
import { MAX_INTEGER, MAX_ARRAY_LENGTH } from './utils';
import toLength from '../src/toLength';
describe('toLength', () => {
it('should return a valid length', () => {
expect(toLength(-1)).toBe(0);
expect(toLength('1')).toBe(1);
expect(toLength(1.1)).toBe(1);
expect(toLength(MAX_INTEGER)).toBe(MAX_ARRAY_LENGTH);
});
it('should return `value` if a valid length', () => {
expect(toLength(0)).toBe(0);
expect(toLength(3)).toBe(3);
expect(toLength(MAX_ARRAY_LENGTH)).toBe(MAX_ARRAY_LENGTH);
});
it('should convert `-0` to `0`', () => {
expect(1 / toLength(-0)).toBe(Infinity);
});
});