updeep-remeda/test/omitBy-spec.js

19 lines
448 B
JavaScript
Raw Normal View History

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