UNPKG

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.

47 lines (44 loc) 1.24 kB
"use strict"; var _objectMap = require("./object-map"); 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); } describe('objectMap()', function () { it('performs an immutable maps over an object', function () { var mock = { foo: 128, bar: 256 }; var result = (0, _objectMap.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 = (0, _objectMap.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 }); }); });