Skip to content

Instantly share code, notes, and snippets.

@pgte
Created August 5, 2011 13:44
Show Gist options
  • Save pgte/1127563 to your computer and use it in GitHub Desktop.
Save pgte/1127563 to your computer and use it in GitHub Desktop.
example
pipeline = new Pipeline('test pipeline 2', {
load: loadFunction
, save: saveFunction
});
pipeline
.on('initial', initialHandler, {
success: 'a'
, condition: function(doc) {
conditionCalled = true;
return true;
}
})
.on('a', aHandler, {
success: 'b'
})
.on('b', function() {
bHandlerCalled = true;
assert.ok(jobId);
console.log('.state');
pipeline.state(jobId, function(err, state) {
console.log(state);
assert.ok(! err);
assert.equal('b', state);
});
})
.push({a:1, b:2, id: 2}, function(err, id) {
console.log('pushed');
assert.isNull(err);
assert.ok(id);
calledback = true;
jobId = id;
})
.then(function(doc) {
promiseFulfilled = true;
assert.eql({"a":3,"b":4,"id":2,"state":{"state":"b","doc_id":2}}, doc);
})
.error(function(err) {
assert.ok(false, err);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment