@eluvio/elv-js-helpers
Version:
A collection of Javascript helper functions used by several Eluvio libraries.
15 lines (11 loc) • 471 B
JavaScript
const TH = require('../../../test-helpers')
const assocComputed = TH.requireSrcFile('Functional/assocComputed')
describe('assocComputed', () => {
it('should work as expected', () => {
assocComputed('bar', x => x.foo * 2, {foo: 2}).should.eql({foo: 2, bar: 4})
})
it('should be curried', () => {
const addTax = assocComputed('tax', x => x.price * 0.05)
addTax({product: 'towel', price: 1}).should.eql( {product: 'towel', price: 1, tax: 0.05})
})
})