Medium/shepherd

not enough async documentation/tests - BUG

boxxxie opened this issue · 4 comments

i'm trying to use promises with graph.add

var fs = require("q-io/fs");
 var graph = new shepherd.Graph();

  graph.add('config', function(){
    return fs.read("config.json").then(JSON.parse);
  });

  var builder = graph.newBuilder()
  .builds('config');

  builder
  .run({str: "Hello"})
  .then(function(data) {
    console.log(data);
  });

output

{ config: { state: 'pending' } }

i'm not sure why my promises aren't working with builds()

what result were you expecting?

i was expecting the promise to be resolved and for config to have the value of the resolution.
i was expecting what i would get via the callback style (which works)

  graph.add('cb-config', function(next){
    fs.read("config.json")
    .then(JSON.parse)
    .then(_.partial(next,null),next);
  });

hmmm...i see...something about the A+/promises interop isn't working correctly; we'll take a look, thanks for filing.

wow, is this resolved?