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