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