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: 3 }, { index: 1 }, { index: 0 }, { index: 4 }, { index: 2 } ]) assert.equal(data[0].index, 4) }) it('asc', function() { const options = [ 'index' ] const data = orderBy(options, [ { index: 3 }, { index: 1 }, { index: 0 }, { index: 4 }, { index: 2 } ]) assert.equal(data[0].index, 0) }) })