UNPKG

apphouse

Version:

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

39 lines (35 loc) 819 B
import { omit } from './omit'; describe('omit', () => { test('should omit all keys from an object', () => { const obj = { name: 'John', __typename: { name: 'John' } }; const newObj = omit(obj, ['__typename']); expect(newObj).toEqual({ name: 'John' }); }); test('should return an empty object if all keys are omitted', () => { const obj = { name: 'John', __typename: { name: 'John' } }; const newObj = omit(obj, ['__typename', 'name']); expect(newObj).toEqual({}); }); test('should return the original object if no keys are omitted', () => { const obj = { name: 'John', __typename: { name: 'John' } }; const newObj = omit(obj, []); expect(newObj).toEqual(obj); }); });