Skip to content

Commit

Permalink
Merge pull request #163 from Eagerod/fixer/add-properties
Browse files Browse the repository at this point in the history
Fixed a callback issue in addProperties
  • Loading branch information
gangstead committed Oct 27, 2016
2 parents e7b5449 + 9b5f65b commit d550674
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/prompt.js
Expand Up @@ -689,7 +689,7 @@ prompt.addProperties = function (obj, properties, callback) {
});

if (properties.length === 0) {
return callback(obj);
return callback(null, obj);
}

prompt.get(properties, function (err, results) {
Expand Down
14 changes: 14 additions & 0 deletions test/prompt-test.js
Expand Up @@ -647,6 +647,20 @@ vows.describe('prompt').addBatch({
}
}
}
}).addBatch({
"When using prompt": {
"the addProperties() method": {
topic: function () {
prompt.addProperties({'foo': 'foo', 'bar': 'bar'}, [], this.callback);
},
"should return the object as-is when no properties provided": function (err, obj) {
assert.isNull(err);
assert.isObject(obj);
assert.equal(obj.foo, 'foo');
assert.equal(obj.bar, 'bar');
}
}
}
}).addBatch({
"When using prompt": {
"the get() method": {
Expand Down

0 comments on commit d550674

Please sign in to comment.