react-native-easy-calendar
Version:
Customizable, easy-to-use, performant calendar components for React Native
39 lines (36 loc) • 1.65 kB
JavaScript
"use strict";
var _clamp = _interopRequireDefault(require("./clamp"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
describe('works in the positive ranges', () => {
test('returns the input in range min..max', () => {
expect((0, _clamp.default)(10, 10, 20)).toBe(10);
expect((0, _clamp.default)(20, 10, 20)).toBe(20);
});
test('returns the maximum for values greater than the maximum', () => {
expect((0, _clamp.default)(21, 10, 20)).toBe(20);
expect((0, _clamp.default)(200, 10, 20)).toBe(20);
expect((0, _clamp.default)(20000, 10, 20)).toBe(20);
});
test('returns the minimum for values less than the minimum', () => {
expect((0, _clamp.default)(9, 10, 20)).toBe(10);
expect((0, _clamp.default)(0, 10, 20)).toBe(10);
expect((0, _clamp.default)(-10, 10, 20)).toBe(10);
});
});
describe('works in negative ranges', () => {
test('returns the input in range min..max', () => {
expect((0, _clamp.default)(-100, -100, -20)).toBe(-100);
expect((0, _clamp.default)(-20, -100, -20)).toBe(-20);
});
test('returns the maximum for values greater than the maximum', () => {
expect((0, _clamp.default)(-9, -20, -10)).toBe(-10);
expect((0, _clamp.default)(0, -20, -10)).toBe(-10);
expect((0, _clamp.default)(200, -20, -10)).toBe(-10);
});
test('returns the minimum for values less than the minimum', () => {
expect((0, _clamp.default)(-21, -20, -10)).toBe(-20);
expect((0, _clamp.default)(-100, -20, -10)).toBe(-20);
expect((0, _clamp.default)(-10000, -20, -10)).toBe(-20);
});
});
//# sourceMappingURL=clamp.test.js.map