UNPKG

apphouse

Version:

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

44 lines (33 loc) 948 B
import { values } from './values'; describe('values', () => { test('should return an array of values from an object', () => { const obj = { a: 1, b: 2, c: 3 }; const result = values(obj); expect(result).toEqual([1, 2, 3]); }); test('should return an empty array if the object has no values', () => { const obj = {}; const result = values(obj); expect(result).toEqual([]); }); test('should throw a TypeError if the input is not an object', () => { const input = 123; expect(() => { // eslint-disable-next-line @typescript-eslint/ban-ts-comment //@ts-ignore values(input); }).toThrow(TypeError); }); test('should throw a TypeError if the input is null', () => { const input = null; expect(() => { // eslint-disable-next-line @typescript-eslint/ban-ts-comment //@ts-ignore values(input); }).toThrow(TypeError); }); });