UNPKG

apphouse

Version:

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

32 lines (23 loc) 607 B
import { keys } from './keys'; describe('keys', () => { test('should return an array of keys from a non-empty object', () => { const obj = { a: 1, b: 2, c: 3 }; const result = keys(obj); expect(result).toEqual(['a', 'b', 'c']); }); test('should return an empty array if the object is empty', () => { const obj = {}; const result = keys(obj); expect(result).toEqual([]); }); test('should throw a TypeError if the input is not an object', () => { const input = 123; expect(() => { keys(input); }).toThrow(TypeError); }); });