Commit e70526f8 authored by Eirik Alvær's avatar Eirik Alvær
Browse files

added method to get short help description

parent 57d1cacf
......@@ -193,9 +193,10 @@ function CommandExecutor() {
// Make the request
req.send(JSON.stringify(postData));
});
};
},
helpCommands = Object.keys(helpTexts);
var helpCommands = Object.keys(helpTexts);
helpCommands.sort();
helpCommands.forEach(function (helpCommand) {
helpTexts.help.description += " " + helpCommand;
......@@ -241,6 +242,10 @@ function CommandExecutor() {
}
return intermediateResult.then(callbackFun, errorFun);
},
getShortHelpDescription: function (command) {
return helpTexts[command].shortDescription;
}
};
}
/*global CommandExecutor, mockedFunctions, ExpectedResults, Promise, describe, it, expect */
/*global CommandExecutor, mockedFunctions, ExpectedResults, Promise, describe, it, expect, assert */
var ce = new CommandExecutor();
var sessionId,
......@@ -83,4 +83,12 @@ describe('Tests', function () {
validate(input, {result: "history"}, done);
});
});
describe('#shortHelpDescription', function () {
it('should return a short help description for given command', function (done) {
var result = ce.getShortHelpDescription("tabulate");
assert(result.length > 30, "description for tabulate is too short");
done();
});
});
});
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment