UNPKG

apphouse

Version:

Component library for React that uses observable state management and theme-able components.

44 lines (35 loc) 1.11 kB
import { isEmpty } from './isEmpty'; describe('isEmpty', () => { test('should return true for null', () => { const result = isEmpty(null); expect(result).toBe(true); }); test('should return true for undefined', () => { const result = isEmpty(undefined); expect(result).toBe(true); }); test('should return true for an empty string', () => { const result = isEmpty(''); expect(result).toBe(true); }); test('should return true for an empty array', () => { const result = isEmpty([]); expect(result).toBe(true); }); test('should return true for an empty object', () => { const result = isEmpty({}); expect(result).toBe(true); }); test('should return false for a non-empty string', () => { const result = isEmpty('Hello'); expect(result).toBe(false); }); test('should return false for a non-empty array', () => { const result = isEmpty([1, 2, 3]); expect(result).toBe(false); }); test('should return false for a non-empty object', () => { const result = isEmpty({ a: 1 }); expect(result).toBe(false); }); });