UNPKG

@qntm-code/utils

Version:

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

28 lines (27 loc) 981 B
import { isNullOrUndefined } from './isNullOrUndefined'; describe('isNullOrUndefined', () => { it('should return true if value is null', () => { const value = null; expect(isNullOrUndefined(value)).toBe(true); }); it('should return true if value is undefined', () => { const value = undefined; expect(isNullOrUndefined(value)).toBe(true); }); it('should return false if value is "undefined"', () => { const value = 'undefined'; expect(isNullOrUndefined(value)).toBe(false); }); it('should return false if value is empty string', () => { const value = ''; expect(isNullOrUndefined(value)).toBe(false); }); it('should return false if value is 0', () => { const value = 0; expect(isNullOrUndefined(value)).toBe(false); }); it('should return true if value is not set', () => { let value; expect(isNullOrUndefined(value)).toBe(true); }); });