UNPKG

@yoroi/common

Version:

The Common package of Yoroi SDK

30 lines (29 loc) 1.34 kB
"use strict"; var _predicates = require("./predicates"); describe('hasValue', () => { it('should return true for non-empty values', () => { expect((0, _predicates.hasValue)(0)).toBe(true); expect((0, _predicates.hasValue)('')).toBe(true); expect((0, _predicates.hasValue)(false)).toBe(true); expect((0, _predicates.hasValue)([])).toBe(true); expect((0, _predicates.hasValue)({})).toBe(true); }); it('should return false for null or undefined values', () => { expect((0, _predicates.hasValue)(null)).toBe(false); expect((0, _predicates.hasValue)(undefined)).toBe(false); }); }); describe('hasEntryValue', () => { it('should return true for entries with non-empty values', () => { expect((0, _predicates.hasEntryValue)(['key', 0])).toBe(true); expect((0, _predicates.hasEntryValue)(['key', ''])).toBe(true); expect((0, _predicates.hasEntryValue)(['key', false])).toBe(true); expect((0, _predicates.hasEntryValue)(['key', []])).toBe(true); expect((0, _predicates.hasEntryValue)(['key', {}])).toBe(true); }); it('should return false for entries with null or undefined values', () => { expect((0, _predicates.hasEntryValue)(['key', null])).toBe(false); expect((0, _predicates.hasEntryValue)(['key', undefined])).toBe(false); }); }); //# sourceMappingURL=predicates.test.js.map