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/isString.spec.js Normal file
View File

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