UNPKG

@qntm-code/utils

Version:

A collection of useful utility functions with associated TypeScript types. All functions have been unit tested.

30 lines (29 loc) 1.21 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const isNullOrUndefined_1 = require("./isNullOrUndefined"); describe('isNullOrUndefined', () => { it('should return true if value is null', () => { const value = null; expect((0, isNullOrUndefined_1.isNullOrUndefined)(value)).toBe(true); }); it('should return true if value is undefined', () => { const value = undefined; expect((0, isNullOrUndefined_1.isNullOrUndefined)(value)).toBe(true); }); it('should return false if value is "undefined"', () => { const value = 'undefined'; expect((0, isNullOrUndefined_1.isNullOrUndefined)(value)).toBe(false); }); it('should return false if value is empty string', () => { const value = ''; expect((0, isNullOrUndefined_1.isNullOrUndefined)(value)).toBe(false); }); it('should return false if value is 0', () => { const value = 0; expect((0, isNullOrUndefined_1.isNullOrUndefined)(value)).toBe(false); }); it('should return true if value is not set', () => { let value; expect((0, isNullOrUndefined_1.isNullOrUndefined)(value)).toBe(true); }); });