updeep-remeda/test/omitBy-spec.js

16 lines
441 B
JavaScript
Raw Normal View History

2016-05-30 21:11:21 +00:00
import { expect } from 'chai';
import u from '../lib';
describe('u.omitBy', () => {
it('can omitBy with a function', () => {
const predicate = (value, key) => (value === 7 && key === 'bar');
const result = u({ foo: u.omitBy(predicate) }, { foo: { bar: 7, baz: 'a' } });
expect(result).to.eql({ foo: { baz: 'a' } });
});
it('freezes the result', () => {
expect(Object.isFrozen(u.omit('a', {}))).to.be.true;
});
});