test('utils test suite', t => { t.test('should curry function with two arguments', t => { const sum = curry((a, b) => a + b); const plusTwo = sum(2); t.equal(sum(3, 2), 5, 'should return result when called with two arguments'); t.equal(typeof plusTwo, 'function', 'should return a function when called with one argument'); t.equal(plusTwo(4), 6, 'should curry function if called with one argument'); }); })
test('includes test suite', t => { t.test('includes', async t => { const has3 = await includes(3, counterGenerator(5)); t.equal(has3, true, 'should have 3'); const has666 = await includes(666, counterGenerator(5)); t.equal(has666, false, 'should not have 666'); const has1 = await includes(0, 1, counterGenerator(5)); t.equal(has1, false, 'should not have 0 when starting at 1'); const has5 = await includes(5, 3, counterGenerator(10)); t.equal(has5, true, 'should have 5 when starting at 3'); }); t.test('includes curried', async t => { const has3 = await includes(3)(counterGenerator(5)); t.equal(has3, true, 'should have 3'); const has666 = await includes(666)(counterGenerator(5)); t.equal(has666, false, 'should not have 666'); const has1 = await includes(0, 1)(counterGenerator(5)); t.equal(has1, false, 'should not have 0 when starting at 1'); const has5 = await includes(5, 3)(counterGenerator(10)); t.equal(has5, true, 'should have 5 when starting at 3'); }); })
test('test suite for reduce', t => { t.test('basic', async t => { let index = 0; const value = await reduce((acc, curr, i) => { }); t.test('with no initial value', async t => { let index = 1; const value = await reduce((acc, curr, i) => { }); t.test('curried', async t => { let index = 0; const reducer = reduce((acc, curr, i) => { }); t.test('curried with no initial value', async t => { let index = 1; const reducer = reduce((acc, curr, i) => {
test('find test suite', t => { t.test('find', async t => { let i = 0; const value = await find((item, index) => { t.test('find: no result', async t => { let i = 0; const value = await find((item, index) => { t.test('find curried', async t => { let i = 0; t.test('find curried with no result', async t => { let i = 0; t.test('find Index', async t => { let i = 0; const value = await findIndex((item, index) => { t.test('find Index: no result', async t => { let i = 0; const value = await findIndex((item, index) => { t.test('find Index curried', async t => { let i = 0; t.test('find Index curried with no result', async t => { let i = 0;
test('slice operator test suite', t => { t.test('basic: all arguments', async t => { let i = 0; const to5 = counterGenerator(5); t.test('basic: with no end', async t => { let i = 0; const to5 = counterGenerator(5); t.test('basic: with no end and no start', async t => { let i = 0; const to5 = counterGenerator(5); t.test('curry with start and end', async t => { const sl = slice(1, 4); const result = []; t.test('curry with only start', async t => { let i = 0; const to5 = counterGenerator(5); t.test('curry with no start and with no end', async t => { let i = 0; const to5 = counterGenerator(5); t.test('forward the consumable nature of the underlying asyncIterable: gen', async t => { const to5 = counterGenerator(5); let i = 0;
test('filter operator test suite', t => { t.test('basic filter', async t => { let i = 0; const to3 = counterGenerator(); }); t.test('filter: forward the consumable nature of the underlying asyncIterator', async t => { let i = 0; const to3 = counterIterable(); t.test('should forward control flow event', async t => { let i = 0; const to3 = breakableCounter(); t.test('curried filter', async t => { const odd = filter(x => x % 2 === 0); let i = 0;
test('take operator', t => { t.test('basic', async t => { let i = 0; const to3 = counterGenerator(); t.test('forward the consumable nature of the underlying asyncIterator', async t => { let i = 0; const to3 = counterIterable(); t.test('forward control flow event', async t => { let i = 0; const to3 = breakableCounter(); }); t.test('curried take', async t => { const getTwo = take(2); let i = 0;
test('flat map operator', t => { t.test('basic: should simply map if items are not asyncIterable', async t => { let index = 0; const gen = async function* () { }); t.test('basic: should flatten asyncIterator items', async t => { let index = 0; const gen = async function* () { }); t.test('should forward the consumable nature of the asyncIterable', async t => { let index = 0; const gen = async function* () { }); t.test('forward control flow event', async t => {
test('map operator test suite', t => { t.test('basic', async t => { let i = 0; const to3 = counterGenerator(); t.test('forward the consumable nature of the underlying asyncIterable', async t => { let i = 0; const to3 = counterIterable(); }); t.test('forward control flow event', async t => { let i = 0; const to3 = breakableCounter(); t.test('curried map', async t => { const square = map(x => x * x); let i = 0;
test('skip operator', t => { t.test('basic', async t => { let i = 1; const to3 = counterGenerator(); t.test('forward the consumable nature of the underlying asyncIterator', async t => { let i = 1; const to3 = counterIterable(); t.test('forward control flow event', async t => { let i = 0; const to3 = breakableCounter(); }); t.test('curried skip', async t => { const skipOne = skip(1); let i = 1;