const { assert } = require('chai') const fs = require('fs') describe('Filter', function () { // get function const reduce = require('./../src/reduce.js') // check results it('reduce, limit', function() { const options = { limit: 2 } const data = reduce(options, [ { index: 0 }, { index: 1 }, { index: 2 }, { index: 3 }, { index: 4 } ]) assert.equal(data.length, 2) }) // check results it('reduce, offset', function() { const options = { offset: 2 } const data = reduce(options, [ { index: 0 }, { index: 1 }, { index: 2 }, { index: 3 }, { index: 4 } ]) assert.equal(data[0].index, 2) }) // check results it('reduce, limit / offset', function() { const options = { offset: 2, limit: 3 } const data = reduce(options, [ { index: 0 }, { index: 1 }, { index: 2 }, { index: 3 }, { index: 4 } ]) assert.equal(data[0].index, 2) assert.equal(data.length, 3) }) })