js: Add description and params list to API functions
This commit is contained in:
parent
fc9ab6053a
commit
3045ac0158
@ -263,6 +263,8 @@ Mopidy.prototype._createApi = function (methods) {
|
||||
var methodName = mopidy._snakeToCamel(methodPath.slice(-1)[0]);
|
||||
var object = createObjects(methodPath.slice(0, -1));
|
||||
object[methodName] = caller(fullMethodName);
|
||||
object[methodName].description = methods[fullMethodName].description;
|
||||
object[methodName].params = methods[fullMethodName].params;
|
||||
};
|
||||
|
||||
Object.keys(methods).forEach(createMethod);
|
||||
|
||||
@ -591,7 +591,11 @@ buster.testCase("Mopidy", {
|
||||
});
|
||||
|
||||
assert.isFunction(this.mopidy.hello);
|
||||
assert.equals(this.mopidy.hello.description, "Says hello");
|
||||
assert.equals(this.mopidy.hello.params, []);
|
||||
assert.isFunction(this.mopidy.hi);
|
||||
assert.equals(this.mopidy.hi.description, "Says hi");
|
||||
assert.equals(this.mopidy.hi.params, []);
|
||||
},
|
||||
|
||||
"can create an API with methods on a sub-object": function () {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user