@guj/rif-js
Version:
Simplify filter,map and such when their use should be conditionnal
19 lines (14 loc) • 517 B
JavaScript
const test = require("ava");
const Rif = require("../main/rif");
test('Rifs should slice when allowed to', t => {
const rSut = Rif
.of([1,2,3])
.sliceIf(true)(1);
t.deepEqual(rSut, [2,3], `Since we allow the slicing, we expect the result to be sliced`);
});
test('Rifs should not slice when unallowed to', t => {
const rSut = Rif
.of([1,2,3])
.sliceIf(false)(1);
t.deepEqual(rSut, [1,2,3], `Since we forbid the slicing, we expect the result to be left as is`);
});