diff --git a/.circleci/config.yml b/.circleci/config.yml index f81335d..12d2857 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -46,7 +46,9 @@ jobs: - run: name: Run tests and coverage - command: npm run coverage + command: | + set -e + npm run coverage - run: name: Send coverage to Code Climate diff --git a/test/func/list.spec.js b/test/func/list.spec.js index 7236272..2e63a20 100644 --- a/test/func/list.spec.js +++ b/test/func/list.spec.js @@ -61,25 +61,25 @@ describe('Functional: list()', function () { const seven = list(archive, '*.txt', { r: true }) const data = [] const expectedData = [ - { datetime: new Date('2018-10-13T09:29:26.000Z'), - attributes: '....A', - size: 9, - sizeCompressed: undefined, - file: 'DirExt/root.txt' }, - { datetime: new Date('2018-10-13T09:28:52.000Z'), - attributes: '....A', - size: 9, - sizeCompressed: undefined, - file: 'DirExt/sub1/sub1.txt' }, - { datetime: new Date('2018-10-13T09:29:39.000Z'), - attributes: '....A', - size: 9, - sizeCompressed: undefined, - file: 'DirExt/sub2/sub2.txt' } + { attributes: '....A', size: 9, sizeCompressed: undefined, file: 'DirExt/root.txt' }, + { attributes: '....A', size: 9, sizeCompressed: undefined, file: 'DirExt/sub1/sub1.txt' }, + { attributes: '....A', size: 9, sizeCompressed: undefined, file: 'DirExt/sub2/sub2.txt' } ] seven.on('data', d => data.push(d)) seven.on('end', function () { - expect(data).to.deep.equal(expectedData) + const withoutDatetime = data + .map(function (d) { + const { datetime, ...rest } = d + return rest + }) + const dates = data.map(d => d.datetime) + for (let d of dates) { + expect(d).to.be.a('date') + } + expect(withoutDatetime).to.deep.contain(expectedData[0]) + expect(withoutDatetime).to.deep.contain(expectedData[1]) + expect(withoutDatetime).to.deep.contain(expectedData[2]) + expect(data.length).to.equal(3) done() }) })