UNPKG

@gravity-ui/data-source

Version:
27 lines (26 loc) 1.28 kB
"use strict"; var _constants = require("../../constants"); var _formatNullableValue = require("../formatNullableValue"); describe('formatNullableValue', function () { it('should return undefinedSymbol for undefined', function () { expect((0, _formatNullableValue.formatNullableValue)(undefined)).toBe(_constants.undefinedSymbol); }); it('should return nullSymbol for null', function () { expect((0, _formatNullableValue.formatNullableValue)(null)).toBe(_constants.nullSymbol); }); it('should return the value for non-nullable values', function () { expect((0, _formatNullableValue.formatNullableValue)(42)).toBe(42); expect((0, _formatNullableValue.formatNullableValue)(0)).toBe(0); expect((0, _formatNullableValue.formatNullableValue)('test')).toBe('test'); expect((0, _formatNullableValue.formatNullableValue)('')).toBe(''); expect((0, _formatNullableValue.formatNullableValue)(true)).toBe(true); expect((0, _formatNullableValue.formatNullableValue)(false)).toBe(false); var obj = { a: 1 }; expect((0, _formatNullableValue.formatNullableValue)(obj)).toBe(obj); var arr = [1, 2, 3]; expect((0, _formatNullableValue.formatNullableValue)(arr)).toBe(arr); }); }); // #sourceMappingURL=formatNullableValue.test.js.map