Example #1
0
 it('should give the appropriate usage text given arguments', () => {
   let cmd = {
     execute: (args: JSONObject) => { return args; },
     usage: (args: JSONObject) => { return JSON.stringify(args); }
   };
   registry.addCommand('test', cmd);
   expect(registry.usage('test', {})).to.equal('{}');
 });
Example #2
0
 it('should get the usage text for a specific command', () => {
   let cmd = {
     execute: (args: JSONObject) => { return args; },
     usage: 'foo'
   };
   registry.addCommand('test', cmd);
   expect(registry.usage('test')).to.equal('foo');
 });
Example #3
0
 it('should default to an empty string for a command', () => {
   registry.addCommand('test', NULL_COMMAND);
   expect(registry.usage('test')).to.equal('');
 });
Example #4
0
 it('should return an empty string if the command is not registered', () => {
   expect(registry.usage('foo')).to.equal('');
 });