updeep-remeda/test/constant-spec.js

18 lines
407 B
JavaScript
Raw Normal View History

2015-08-13 05:31:01 +00:00
import expect from 'expect';
import u from '../lib';
describe('u.constant', () => {
it('returns what it is given... constantly', () => {
const func = u.constant(4);
2015-08-13 05:31:01 +00:00
expect(func()).toBe(4);
expect(func('hi')).toBe(4);
expect(func('hi', 8)).toBe(4);
expect(func(4)).toBe(4);
});
it('freezes the result', () => {
2015-08-13 05:31:01 +00:00
expect(Object.isFrozen(u.constant({})())).toBe(true);
});
});