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