updeep-remeda/test/constant-spec.js

18 lines
414 B
JavaScript
Raw Normal View History

2017-04-19 00:55:46 +00:00
import { expect } from 'chai'
import u from '../lib'
describe('u.constant', () => {
it('returns what it is given... constantly', () => {
2017-04-19 00:55:46 +00:00
const func = u.constant(4)
2017-04-19 00:55:46 +00:00
expect(func()).to.equal(4)
expect(func('hi')).to.equal(4)
expect(func('hi', 8)).to.equal(4)
expect(func(4)).to.equal(4)
})
it('freezes the result', () => {
2017-04-19 00:55:46 +00:00
expect(Object.isFrozen(u.constant({})())).to.be.true
})
})