const { assert } = require('chai') const fs = require('fs') describe('OrderBy', function () { // get function const orderBy = require('./../src/orderBy.js') // check results it('desc', function() { const options = [ '-index' ] const data = orderBy(options, [ { index: 0 }, { index: 1 }, { index: 2 }, { index: 3 }, { index: 4 } ]) assert.equal(data[0].index, 4) }) it('asc', function() { const options = [ 'index' ] const data = orderBy(options, [ { index: 0 }, { index: 1 }, { index: 2 }, { index: 3 }, { index: 4 } ]) assert.equal(data[0].index, 0) }) })