UNPKG

zarm

Version:

基于 React 的移动端UI库

30 lines (27 loc) 934 B
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); var _getValue = _interopRequireDefault(require("../../utils/getValue")); describe('getValue', function () { it('should return props.value if it exists', function () { var actual = (0, _getValue.default)({ value: 1 }, 0); expect(actual).toEqual(1); }); it('should return props.defaultValue if it exists', function () { var actual = (0, _getValue.default)({ defaultValue: 1 }, 0); expect(actual).toEqual(1); }); it("should return default value if props.value and props.defaultValue don't exist", function () { var actual = (0, _getValue.default)({}, 1); expect(actual).toEqual(1); }); it('should return default value if props.defaultValue is 0', function () { var actual = (0, _getValue.default)({ defaultValue: 0 }, 1); expect(actual).toEqual(1); }); });