function Outcome(args) {
  this.url      = args.url;
  this.elapsed  = hrTime(args.elapsed);
  if (args.error && args.error.code === 'ETIMEDOUT') {
    this.reason   = 'timeout';
    this.timeout  = true;
  } else if (args.error) {
    this.reason   = 'error';
    this.error    = args.error;
  } else {

    this.statusCode = args.statusCode;
    this.body       = args.body;
    if (this.statusCode < 200 || this.statusCode >= 400)
      this.reason   = 'statusCode';
    else {

      const expected    = args.expected;
      const allMatching = expected.every(text => ~args.body.indexOf(text));
      if (!allMatching)
        this.reason = 'body';

    }
  }
  this.log();
}
// expected   - Expected response body (array)
expected   - Expected response body (array)
expected - Expected response body ( array )
function Outcome(args) {
  this.url      = args.url;
  this.elapsed  = hrTime(args.elapsed);
  if (args.error && args.error.code === 'ETIMEDOUT') {
    this.reason   = 'timeout';
    this.timeout  = true;
  } else if (args.error) {
    this.reason   = 'error';
    this.error    = args.error;
  } else {
    this.statusCode = args.statusCode;
    this.body       = args.body;
    if (this.statusCode < 200 || this.statusCode >= 400)
      this.reason   = 'statusCode';
    else {
      const expected    = args.expected;
      const allMatching = expected.every(text => ~args.body.indexOf(text));
      if (!allMatching)
        this.reason = 'body';
    }
  }
  this.log();
}
function Outcome ( args ) { this . url = args . url ; this . elapsed = hrTime ( args . elapsed ) ; if ( args . error && args . error . code === 'ETIMEDOUT' ) { this . reason = 'timeout' ; this . timeout = true ; } else if ( args . error ) { this . reason = 'error' ; this . error = args . error ; } else { this . statusCode = args . statusCode ; this . body = args . body ; if ( this . statusCode < 200 || this . statusCode >= 400 ) this . reason = 'statusCode' ; else { const expected = args . expected ; const allMatching = expected . every ( text => ~ args . body . indexOf ( text ) ) ; if ( ! allMatching ) this . reason = 'body' ; } } this . log ( ) ; }
expected   - Expected response body (array)
expected - Expected response body ( array )