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

43
test/toString.spec.ts Normal file
View File

@@ -0,0 +1,43 @@
import assert from 'node:assert';
import lodashStable from 'lodash';
import { stubString, symbol } from './utils';
import toString from '../src/toString';
describe('toString', () => {
it('should treat nullish values as empty strings', () => {
const values = [, null, undefined],
expected = lodashStable.map(values, stubString);
const actual = lodashStable.map(values, (value, index) =>
index ? toString(value) : toString(),
);
assert.deepStrictEqual(actual, expected);
});
it('should preserve the sign of `0`', () => {
const values = [-0, Object(-0), 0, Object(0)],
expected = ['-0', '-0', '0', '0'],
actual = lodashStable.map(values, toString);
assert.deepStrictEqual(actual, expected);
});
it('should preserve the sign of `0` in an array', () => {
const values = [-0, Object(-0), 0, Object(0)];
assert.deepStrictEqual(toString(values), '-0,-0,0,0');
});
it('should handle symbols', () => {
assert.strictEqual(toString(symbol), 'Symbol(a)');
});
it('should handle an array of symbols', () => {
assert.strictEqual(toString([symbol]), 'Symbol(a)');
});
it('should return the `toString` result of the wrapped value', () => {
const wrapped = _([1, 2, 3]);
assert.strictEqual(wrapped.toString(), '1,2,3');
});
});