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

37
test/isNaN.spec.js Normal file
View File

@@ -0,0 +1,37 @@
import lodashStable from 'lodash';
import { falsey, args, slice, symbol, realm } from './utils';
import isNaN from '../src/isNaN';
describe('isNaN', () => {
it('should return `true` for NaNs', () => {
expect(isNaN(NaN)).toBe(true);
expect(isNaN(Object(NaN))).toBe(true);
});
it('should return `false` for non-NaNs', () => {
const expected = lodashStable.map(falsey, (value) => value !== value);
const actual = lodashStable.map(falsey, (value, index) => (index ? isNaN(value) : isNaN()));
expect(actual).toEqual(expected);
expect(isNaN(args)).toBe(false);
expect(isNaN([1, 2, 3])).toBe(false);
expect(isNaN(true)).toBe(false);
expect(isNaN(new Date())).toBe(false);
expect(isNaN(new Error())).toBe(false);
expect(isNaN(slice)).toBe(false);
expect(isNaN({ a: 1 })).toBe(false);
expect(isNaN(1)).toBe(false);
expect(isNaN(Object(1))).toBe(false);
expect(isNaN(/x/)).toBe(false);
expect(isNaN('a')).toBe(false);
expect(isNaN(symbol)).toBe(false);
});
it('should work with `NaN` from another realm', () => {
if (realm.object) {
expect(isNaN(realm.nan)).toBe(true);
}
});
});