mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-06 09:47:48 +00:00
wip: code formatting nits continued
This commit is contained in:
26
test/min.spec.js
Normal file
26
test/min.spec.js
Normal file
@@ -0,0 +1,26 @@
|
||||
import lodashStable from 'lodash';
|
||||
import { falsey, noop } from './utils';
|
||||
import min from '../src/min';
|
||||
|
||||
describe('min', () => {
|
||||
it('should return the smallest value from a collection', () => {
|
||||
expect(min([1, 2, 3])).toBe(1);
|
||||
});
|
||||
|
||||
it('should return `undefined` for empty collections', () => {
|
||||
const values = falsey.concat([[]]),
|
||||
expected = lodashStable.map(values, noop);
|
||||
|
||||
const actual = lodashStable.map(values, (value: false, index: number) => {
|
||||
try {
|
||||
return index ? min(value) : min();
|
||||
} catch (e) {}
|
||||
});
|
||||
|
||||
expect(actual).toEqual(expected);
|
||||
});
|
||||
|
||||
it('should work with non-numeric collection values', () => {
|
||||
expect(min(['a', 'b'])).toBe('a');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user