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

31
test/padStart.spec.js Normal file
View File

@@ -0,0 +1,31 @@
import lodashStable from 'lodash';
import { stubTrue } from './utils';
import padStart from '../src/padStart';
describe('padStart', () => {
const string = 'abc';
it('should pad a string to a given length', () => {
const values = [, undefined];
const expected = lodashStable.map(values, lodashStable.constant(' abc'));
const actual = lodashStable.map(values, (value, index) =>
index ? padStart(string, 6, value) : padStart(string, 6),
);
expect(actual).toEqual(expected);
});
it('should truncate pad characters to fit the pad length', () => {
expect(padStart(string, 6, '_-')).toBe('_-_abc');
});
it('should coerce `string` to a string', () => {
const values = [Object(string), { toString: lodashStable.constant(string) }];
const expected = lodashStable.map(values, stubTrue);
const actual = lodashStable.map(values, (value) => padStart(value, 6) === ' abc');
expect(actual).toEqual(expected);
});
});