let date = new Date(Date.now()) console.log('run:', date.getMinutes(), ':', date.getSeconds()) import { expect } from 'chai' import * as _ from '../src/array.js' describe('Array Library - ', function () { it('Should flatten an array', function () { expect(_.flatten([ [1], [2], [3] ])).deep.equal([1, 2, 3]) expect(_.flatten([1, 2, 3])).deep.equal([1, 2, 3]) }) it('Should sum an array', function () { expect(_.sum([1, 2, 3])).to.equal(6) expect(_.sum([1, 'shut', 'up'])).to.equal('1shutup') }) it('Should pad left an array to 8 with zeros by defaul', function () { expect(_.padStart([1, 2, 3])).to.deep.equal([0,0,0,0,0,1,2,3]) }) it('Should ignore pad when not longer than array', function () { expect(_.padStart([1, 2, 3],3,'a')).to.deep.equal([1,2,3]) }) it('Should pad left an array with character', function () { expect(_.padStart([1, 2, 3],5,'a')).to.deep.equal(['a','a',1,2,3]) }) it('Should pad right an array to 8 with zeros by defaul', function () { expect(_.padEnd([1, 2, 3])).to.deep.equal([1,2,3,0,0,0,0,0]) }) it('Should ignore pad when not longer than array', function () { expect(_.padEnd([1, 2, 3],3,'a')).to.deep.equal([1,2,3]) }) it('Should pad left an array with character', function () { expect(_.padEnd([1, 2, 3],5,'a')).to.deep.equal([1,2,3,'a','a']) }) })