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