1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | 1× 1× 1× 1× 1× 1× 1× 1× 1× 4× | import expect from 'expect'; import mapValues from '../mapValues'; describe('mapValues', () => { it('should return undefined when given undefined', () => { expect(mapValues(undefined, () => null)) .toBe(undefined); }); it('should return null when given null', () => { expect(mapValues(null, () => null)) .toBe(null); }); it('should call a function on each value', () => { expect(mapValues({ a: 1, b: 2, c: 3, d: 4 }, value => value * 2)) .toBeA('object') .toEqual({ a: 2, b: 4, c: 6, d: 8 }); }); }); |