Skip to content

Commit

Permalink
globby.sync 馃憣 see #4
Browse files Browse the repository at this point in the history
  • Loading branch information
thejmazz committed Jun 30, 2016
1 parent 3376167 commit f597ed9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
6 changes: 3 additions & 3 deletions lib/Task.js
Expand Up @@ -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')
Expand All @@ -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)
Expand Down Expand Up @@ -154,6 +154,6 @@ const task = (props, actionCreator) => co.wrap(function * () {
// console.log(stream)

return stream
})
}

module.exports = task
15 changes: 6 additions & 9 deletions test/Task.spec.js
Expand Up @@ -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())
})
})
})
Expand Down

0 comments on commit f597ed9

Please sign in to comment.