diff --git a/src/builder/builder.js b/src/builder/builder.js index 237031a..f6d1766 100644 --- a/src/builder/builder.js +++ b/src/builder/builder.js @@ -30,6 +30,7 @@ const defaultOptions = { module.exports = function builder (createChunker, ipld, createReducer, _options) { const options = extend({}, defaultOptions, _options) + options.progress = typeof options.progress === 'function' ? options.progress : defaultOptions.progress return function (source) { return function (items, cb) { diff --git a/test/importer.spec.js b/test/importer.spec.js index 596d69d..8851645 100644 --- a/test/importer.spec.js +++ b/test/importer.spec.js @@ -267,6 +267,23 @@ strategies.forEach((strategy) => { ) }) + it('survives bad progress option', (done) => { + pull( + values([{ + path: '200Bytes.txt', + content: Buffer.from([0, 1, 2]) + }]), + importer(ipld, { + ...options, + progress: null + }), + onEnd((err) => { + expect(err).to.not.exist() + done() + }) + ) + }) + it('doesn\'t yield anything on empty source', (done) => { pull( empty(),