2015-08-19 07:23:18 +00:00
|
|
|
import { expect } from 'chai';
|
2015-08-05 11:29:30 +00:00
|
|
|
import u from '../lib';
|
|
|
|
|
|
|
|
describe('u.reject', () => {
|
2015-08-23 17:48:32 +00:00
|
|
|
it('can reject by index', () => {
|
|
|
|
const result = u.reject((_, index) => index === 1, [3, 4, 5]);
|
|
|
|
|
|
|
|
expect(result).to.eql([3, 5]);
|
|
|
|
});
|
|
|
|
|
2016-01-14 17:04:47 +00:00
|
|
|
it('can reject with callback shorthand', () => {
|
|
|
|
const result = u.reject('bad', [{ bad: true }, { bad: false }]);
|
|
|
|
|
|
|
|
expect(result).to.eql([{ bad: false }]);
|
|
|
|
});
|
|
|
|
|
2015-08-05 11:29:30 +00:00
|
|
|
it('freezes the result', () => {
|
2015-08-19 07:23:18 +00:00
|
|
|
expect(Object.isFrozen(u.reject('a', []))).to.be.true;
|
2015-08-05 11:29:30 +00:00
|
|
|
});
|
|
|
|
});
|