wix-style-react
Version:
wix-style-react
33 lines (26 loc) • 1.13 kB
JavaScript
;
var _times = require('./times');
var _times2 = _interopRequireDefault(_times);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
describe('times operator', function () {
it('should return an empty array for non-number invoke amount', function () {
expect((0, _times2.default)({})).toEqual([]);
expect((0, _times2.default)(true)).toEqual([]);
expect((0, _times2.default)('')).toEqual([]);
expect((0, _times2.default)(null)).toEqual([]);
expect((0, _times2.default)(undefined)).toEqual([]);
expect((0, _times2.default)(Symbol.for('foo'))).toEqual([]);
});
it('should return an empty array for non-function iteratee', function () {
expect((0, _times2.default)(5, 'not-a-function')).toEqual([]);
});
it('should return a range from 0 to X', function () {
expect((0, _times2.default)(3)).toEqual([0, 1, 2]);
});
it('should return iteratee results array', function () {
var multiple = function multiple(value) {
return value + value;
};
expect((0, _times2.default)(3, multiple)).toEqual([0, 2, 4]);
});
});