vcc-ui
Version:
VCC UI is a collection of React UI Components that can be used for developing front-end applications at Volvo Car Corporation.
49 lines (38 loc) • 788 B
JavaScript
import { objectMap } from './object-map';
describe('objectMap()', () => {
it('performs an immutable maps over an object', () => {
const mock = {
foo: 128,
bar: 256,
};
const result = objectMap(x => x * 2)(mock);
expect(result).toEqual({
foo: 256,
bar: 512,
});
expect(mock).toEqual({
foo: 128,
bar: 256,
});
});
it('curries', () => {
const mock1 = {
foo: 128,
bar: 256,
};
const mock2 = {
foo: 256,
bar: 512,
};
const curried = objectMap(x => x * 2);
expect(typeof curried).toEqual('function');
expect(curried(mock1)).toEqual({
foo: 256,
bar: 512,
});
expect(curried(mock2)).toEqual({
foo: 512,
bar: 1024,
});
});
});