From f597ed95cb4272ec208215b4a06a26f73a4488b7 Mon Sep 17 00:00:00 2001 From: Julian Mazzitelli Date: Wed, 29 Jun 2016 22:59:20 -0400 Subject: [PATCH] =?UTF-8?q?globby.sync=20=F0=9F=91=8C=20see=20#4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/Task.js | 6 +++--- test/Task.spec.js | 15 ++++++--------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/lib/Task.js b/lib/Task.js index 31b84f1..50c29ac 100644 --- a/lib/Task.js +++ b/lib/Task.js @@ -74,7 +74,7 @@ class ReadableFromCallback extends stream.Readable { * @param {function} actionCreator function to produce an actionCreator * @return {stream} stream to be orchestrated */ -const task = (props, actionCreator) => co.wrap(function * () { +const task = (props, actionCreator) => () => { // TODO check if actionCreator is a function if (props === null) { console.log('Got null props') @@ -98,7 +98,7 @@ const task = (props, actionCreator) => co.wrap(function * () { // 1. resolve props OR if (input instanceof File) { try { - const globbyData = yield globby(input.value) + const globbyData = globby.sync(input.value) resolvedInput = { input: globbyData[0] } } catch(e) { console.error(e) @@ -154,6 +154,6 @@ const task = (props, actionCreator) => co.wrap(function * () { // console.log(stream) return stream -}) +} module.exports = task diff --git a/test/Task.spec.js b/test/Task.spec.js index 972a894..5d3cf69 100644 --- a/test/Task.spec.js +++ b/test/Task.spec.js @@ -22,17 +22,14 @@ describe('Task', function() { describe('when provided with a Promise', function() { describe('that resolves to a value', function() { it('should return a readable stream', function(done) { - Task(null, () => new Promise((resolve, reject) => resolve('datums')))().then((task) => { - console.log('task: ' + task) + const task = Task(null, () => new Promise((resolve, reject) => resolve('datums')))() - assert.isOk(isReadable(task)) - assert.isNotOk(isWritable(task)) + assert.isOk(isReadable(task)) + assert.isNotOk(isWritable(task)) - task - .on('data', noop) - .on('end', () => done()) - }) - + task + .on('data', noop) + .on('end', () => done()) }) }) })