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.
44 lines (43 loc) • 1.19 kB
JavaScript
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
import { objectMap } from './object-map';
describe('objectMap()', function () {
it('performs an immutable maps over an object', function () {
var mock = {
foo: 128,
bar: 256
};
var result = objectMap(function (x) {
return x * 2;
})(mock);
expect(result).toEqual({
foo: 256,
bar: 512
});
expect(mock).toEqual({
foo: 128,
bar: 256
});
});
it('curries', function () {
var mock1 = {
foo: 128,
bar: 256
};
var mock2 = {
foo: 256,
bar: 512
};
var curried = objectMap(function (x) {
return x * 2;
});
expect(_typeof(curried)).toEqual('function');
expect(curried(mock1)).toEqual({
foo: 256,
bar: 512
});
expect(curried(mock2)).toEqual({
foo: 512,
bar: 1024
});
});
});