src/test/testClientSupport.js
/**
   * @summary **Establish a local workspace for test clients**
   * @description
   * This sets up a local workspace for test clients named 'mochatests',
   * and populates mm with the most useful objects to do client testing.
   * This can be used by 'base' tests since it does not require the meddle
   * server.
   * @example:
   *     before(mochaTestWorkspace()); // populates
   *     mm.test.client.mmc      // the current MMeddleClient
   *     mm.test.client.mConsole // the current console (Mock)
   *     mm.test.client.cmds     // the current CliCommands
   * @returns a promise that resolves when connected.
   * @alias module:test/testClientSupport.mochaTestConnect
   */
@summary **Establish a local workspace for test clients
@description
This sets up a local workspace for test clients named 'mochatests',
and populates mm with the most useful objects to do client testing.
This can be used by 'base' tests since it does not require the meddle
server.
@summary ** Establish a local workspace for test clients @description This sets up a local workspace for test clients named ' mochatests ' and populates mm with the most useful objects to do client testing . This can be used by ' base ' tests since it does not require the meddle server .
function mochaTestWorkspace() {
    try {
      if (mm.test.client.mmc) {
        return;
      }
      var mConsole;
      if (mm.config.inNode) {
        mConsole = new CliConsole();
      }
      else {
        mConsole = new CliConsole('cliInText', 'inTextPrompt', 'consolediv');
      }
      mm.mConsole = mConsole;
      mm.test.client.mConsole = mConsole;
      mm.log.setCliConsole(mConsole);
      mm.log.debug('----- MochaTests Configuration -----\n', mm.config);
      var clientName = 'MochaTests';
      var cs = new ClientSession(clientName);
      var host = mm.configHost();
      var mmc = new MMeddleClient(host, cs);
      mm.test.client.cs = cs;
      mm.test.client.mmc = mmc;
      var cliCmds = new CliCommands(mConsole, cs);
      mm.test.client.cmds = cliCmds;
      cs.bindClient(mmc);
      cs.loadLocalWorkspace();
      cs.loadLocalUser();
    }
    catch (e) {
        mm.log.error('Test Client Setup failed.', e.stack);
    }
  }
function mochaTestWorkspace ( ) { try { if ( mm . test . client . mmc ) { return ; } var mConsole ; if ( mm . config . inNode ) { mConsole = new CliConsole ( ) ; } else { mConsole = new CliConsole ( 'cliInText' , 'inTextPrompt' , 'consolediv' ) ; } mm . mConsole = mConsole ; mm . test . client . mConsole = mConsole ; mm . log . setCliConsole ( mConsole ) ; mm . log . debug ( '----- MochaTests Configuration -----\n' , mm . config ) ; var clientName = 'MochaTests' ; var cs = new ClientSession ( clientName ) ; var host = mm . configHost ( ) ; var mmc = new MMeddleClient ( host , cs ) ; mm . test . client . cs = cs ; mm . test . client . mmc = mmc ; var cliCmds = new CliCommands ( mConsole , cs ) ; mm . test . client . cmds = cliCmds ; cs . bindClient ( mmc ) ; cs . loadLocalWorkspace ( ) ; cs . loadLocalUser ( ) ; } catch ( e ) { mm . log . error ( 'Test Client Setup failed.' , e . stack ) ; } }
@summary **Establish a local workspace for test clients
 @description
 This sets up a local workspace for test clients named 'mochatests',
 and populates mm with the most useful objects to do client testing.
@summary ** Establish a local workspace for test clients @description This sets up a local workspace for test clients named ' mochatests ' and populates mm with the most useful objects to do client testing .