2017-04-19 00:55:46 +00:00
|
|
|
import { expect } from 'chai'
|
|
|
|
import u from '../lib'
|
2015-08-13 05:19:04 +00:00
|
|
|
|
|
|
|
describe('u.constant', () => {
|
|
|
|
it('returns what it is given... constantly', () => {
|
2017-04-19 00:55:46 +00:00
|
|
|
const func = u.constant(4)
|
2015-08-13 05:19:04 +00:00
|
|
|
|
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)
|
|
|
|
})
|
2015-08-13 05:19:04 +00:00
|
|
|
|
|
|
|
it('freezes the result', () => {
|
2017-04-19 00:55:46 +00:00
|
|
|
expect(Object.isFrozen(u.constant({})())).to.be.true
|
|
|
|
})
|
|
|
|
})
|