text: /* @copyright Itential, LLC 2019 (pre-modifications) */
  
  // Set globals
  /* global describe it log pronghornProps */
  /* eslint global-require: warn */
  /* eslint no-unused-vars: warn */
  
  // include required items for testing & logging
  const assert = require('assert');
  const fs = require('fs-extra');
  const mocha = require('mocha');
  const path = require('path');
  const util = require('util');
  const winston = require('winston');
  const execute = require('child_process').execSync;
  const { expect } = require('chai');
  const { use } = require('chai');
  const td = require('testdouble');
  
  const anything = td.matchers.anything();
  
  // stub and attemptTimeout are used throughout the code so set them here
  let logLevel = 'none';
  const stub = true;
  const isRapidFail = false;
  const attemptTimeout = 120000;
  
  // these variables can be changed to run in integrated mode so easier to set them here
  // always check these in with bogus data!!!
  const host = 'replace.hostorip.here';
  const username = 'username';
  const password = 'password';
  const protocol = 'http';
  const port = 80;
  const sslenable = false;
  const sslinvalid = false;
  
  // these are the adapter properties. You generally should not need to alter
  // any of these after they are initially set up
  global.pronghornProps = {
    pathProps: {
      encrypted: false
    },
    adapterProps: {
      adapters: [{
        id: 'Test-Chik-Fill-A-1000I',
        type: 'ChikFillA1000I',
        properties: {
          host,
          port,
          base_path: '/',
          version: 'v6',
          cache_location: 'none',
          encode_pathvars: true,
          save_metric: false,
          stub,
          protocol,
          authentication: {
            auth_method: 'basic user_password',
            username,
            password,
            token: '',
            invalid_token_error: 401,
            token_timeout: -1,
            token_cache: 'local',
            auth_field: 'header.headers.Authorization',
            auth_field_format: 'Basic {b64}{username}:{password}{/b64}'
          },
          healthcheck: {
            type: 'startup',
            frequency: 60000
          },
          throttle: {
            throttle_enabled: false,
            number_pronghorns: 1,
            sync_async: 'sync',
            max_in_queue: 1000,
            concurrent_max: 1,
            expire_timeout: 0,
            avg_runtime: 200,
            priorities: [
              {
                value: 0,
                percent: 100
              }
            ]
          },
          request: {
            number_redirects: 0,
            number_retries: 3,
            limit_retry_error: [0],
            failover_codes: [],
            attempt_timeout: attemptTimeout,
            global_request: {
              payload: {},
              uriOptions: {},
              addlHeaders: {},
              authData: {}
            },
            healthcheck_on_timeout: true,
            return_raw: true,
            archiving: false
          },
          proxy: {
            enabled: false,
            host: '',
            port: 1,
            protocol: 'http'
          },
          ssl: {
            ecdhCurve: '',
            enabled: sslenable,
            accept_invalid_cert: sslinvalid,
            ca_file: '',
            key_file: '',
            cert_file: '',
            secure_protocol: '',
            ciphers: ''
          },
          mongo: {
            host: '',
            port: 0,
            database: '',
            username: '',
            password: '',
            replSet: '',
            db_ssl: {
              enabled: false,
              accept_invalid_cert: false,
              ca_file: '',
              key_file: '',
              cert_file: ''
            }
          }
        }
      }]
    }
  };
  
  global.$HOME = `${__dirname}/../..`;
  
  // set the log levels that Pronghorn uses, spam and trace are not defaulted in so without
  // this you may error on log.trace calls.
  const myCustomLevels = {
    levels: {
      spam: 6,
      trace: 5,
      debug: 4,
      info: 3,
      warn: 2,
      error: 1,
      none: 0
    }
  };
  
  // need to see if there is a log level passed in
  process.argv.forEach((val) => {
    // is there a log level defined to be passed in?
    if (val.indexOf('--LOG') === 0) {
      // get the desired log level
      const inputVal = val.split('=')[1];
  
      // validate the log level is supported, if so set it
      if (Object.hasOwnProperty.call(myCustomLevels.levels, inputVal)) {
        logLevel = inputVal;
      }
    }
  });
  
  // need to set global logging
  global.log = winston.createLogger({
    level: logLevel,
    levels: myCustomLevels.levels,
    transports: [
      new winston.transports.Console()
    ]
  });
  
  /**
   * Runs the error asserts for the test
   */
  function runErrorAsserts(data, error, code, origin, displayStr) {
    assert.equal(null, data);
    assert.notEqual(undefined, error);
    assert.notEqual(null, error);
    assert.notEqual(undefined, error.IAPerror);
    assert.notEqual(null, error.IAPerror);
    assert.notEqual(undefined, error.IAPerror.displayString);
    assert.notEqual(null, error.IAPerror.displayString);
    assert.equal(code, error.icode);
    assert.equal(origin, error.IAPerror.origin);
    assert.equal(displayStr, error.IAPerror.displayString);
  }
  
  // require the adapter that we are going to be using
  const ChikFillA1000I = require('../../adapter.js');
  
  // delete the .DS_Store directory in entities -- otherwise this will cause errors
  const dirPath = path.join(__dirname, '../../entities/.DS_Store');
  if (fs.existsSync(dirPath)) {
    try {
      fs.removeSync(dirPath);
      console.log('.DS_Store deleted');
    } catch (e) {
      console.log('Error when deleting .DS_Store:', e);
    }
  }
  
  // begin the testing - these should be pretty well defined between the describe and the it!
  describe('[unit] Chik-Fill-A-1000I Adapter Test', () => {
    describe('ChikFillA1000I Class Tests', () => {
      const a = new ChikFillA1000I(
        pronghornProps.adapterProps.adapters[0].id,
        pronghornProps.adapterProps.adapters[0].properties
      );
  
      if (isRapidFail) {
        const state = {};
        state.passed = true;
  
        mocha.afterEach(function x() {
          state.passed = state.passed
          && (this.currentTest.state === 'passed');
        });
        mocha.beforeEach(function x() {
          if (!state.passed) {
            return this.currentTest.skip();
          }
          return true;
        });
      }
  
      describe('#class instance created', () => {
        it('should be a class with properties', (done) => {
          try {
            assert.notEqual(null, a);
            assert.notEqual(undefined, a);
            assert.notEqual(null, a.allProps);
            const check = global.pronghornProps.adapterProps.adapters[0].properties.healthcheck.type;
            assert.equal(check, a.healthcheckType);
            done();
          } catch (error) {
            log.error(`Test Failure: ${error}`);
            done(error);
          }
        }).timeout(attemptTimeout);
      });
  
      describe('adapterBase.js', () => {
        it('should have an adapterBase.js', (done) => {
          try {
            fs.exists('adapterBase.js', (val) => {
              assert.equal(true, val);
              done();
            });
          } catch (error) {
            log.error(`Test Failure: ${error}`);
            done(error);
          }
        });
      });
  
      let wffunctions = [];
      describe('#getWorkflowFunctions', () => {
        it('should retrieve workflow functions', (done) => {
          try {
            wffunctions = a.getWorkflowFunctions();
  
            try {
              assert.notEqual(0, wffunctions.length);
              done();
            } catch (err) {
              log.error(`Test Failure: ${err}`);
              done(err);
            }
          } catch (error) {
            log.error(`Adapter Exception: ${error}`);
            done(error);
          }
        }).timeout(attemptTimeout);
      });
  
      describe('package.json', () => {
        it('should have a package.json', (done) => {
          try {
            fs.exists('package.json', (val) => {
              assert.equal(true, val);
              done();
            });
          } catch (error) {
            log.error(`Test Failure: ${error}`);
            done(error);
          }
        });
        it('package.json should be validated', (done) => {
          try {
            const packageDotJson = require('../../package.json');
            const { PJV } = require('package-json-validator');
            const options = {
              warnings: true, // show warnings
              recommendations: true // show recommendations
            };
            const results = PJV.validate(JSON.stringify(packageDotJson), 'npm', options);
  
            if (results.valid === false) {
              log.error('The package.json contains the following errors: ');
              log.error(util.inspect(results));
              assert.equal(true, results.valid);
            } else {
              assert.equal(true, results.valid);
            }
  
            done();
          } catch (error) {
            log.error(`Test Failure: ${error}`);
            done(error);
          }
        });
        it('package.json should be customized', (done) => {
          try {
            const packageDotJson = require('../../package.json');
            assert.notEqual(-1, packageDotJson.name.indexOf('Chik-Fill-A-1000I'));
            assert.notEqual(undefined, packageDotJson.version);
            assert.notEqual(null, packageDotJson.version);
            assert.notEqual('', packageDotJson.version);
            done();
          } catch (error) {
            log.error(`Test Failure: ${error}`);
            done(error);
          }
        });
      });
  
      describe('pronghorn.json', () => {
        it('should have a pronghorn.json', (done) => {
          try {
            fs.exists('pronghorn.json', (val) => {
              assert.equal(true, val);
              done();
            });
          } catch (error) {
            log.error(`Test Failure: ${error}`);
            done(error);
          }
        });
        it('pronghorn.json should be customized', (done) => {
          try {
            const pronghornDotJson = require('../../pronghorn.json');
            assert.notEqual(-1, pronghornDotJson.id.indexOf('Chik-Fill-A-1000I'));
            assert.equal('ChikFillA1000I', pronghornDotJson.export);
            assert.equal('Chik-Fill-A-1000I', pronghornDotJson.title);
            done();
          } catch (error) {
            log.error(`Test Failure: ${error}`);
            done(error);
          }
        });
        it('pronghorn.json should only expose workflow functions', (done) => {
          try {
            const pronghornDotJson = require('../../pronghorn.json');
  
            for (let m = 0; m < pronghornDotJson.methods.length; m += 1) {
              let found = false;
              let paramissue = false;
  
              for (let w = 0; w < wffunctions.length; w += 1) {
                if (pronghornDotJson.methods[m].name === wffunctions[w]) {
                  found = true;
                  const methLine = execute(`grep "  ${wffunctions[w]}(" adapter.js | grep "callback) {"`).toString();
                  let wfparams = [];
  
                  if (methLine && methLine.indexOf('(') >= 0 && methLine.indexOf(')') >= 0) {
                    const temp = methLine.substring(methLine.indexOf('(') + 1, methLine.lastIndexOf(')'));
                    wfparams = temp.split(',');
  
                    for (let t = 0; t < wfparams.length; t += 1) {
                      // remove default value from the parameter name
                      wfparams[t] = wfparams[t].substring(0, wfparams[t].search(/=/) > 0 ? wfparams[t].search(/#|\?|=/) : wfparams[t].length);
                      // remove spaces
                      wfparams[t] = wfparams[t].trim();
  
                      if (wfparams[t] === 'callback') {
                        wfparams.splice(t, 1);
                      }
                    }
                  }
  
                  // if there are inputs defined but not on the method line
                  if (wfparams.length === 0 && (pronghornDotJson.methods[m].input
                      && pronghornDotJson.methods[m].input.length > 0)) {
                    paramissue = true;
                  } else if (wfparams.length > 0 && (!pronghornDotJson.methods[m].input
                      || pronghornDotJson.methods[m].input.length === 0)) {
                    // if there are no inputs defined but there are on the method line
                    paramissue = true;
                  } else {
                    for (let p = 0; p < pronghornDotJson.methods[m].input.length; p += 1) {
                      let pfound = false;
                      for (let wfp = 0; wfp < wfparams.length; wfp += 1) {
                        if (pronghornDotJson.methods[m].input[p].name.toUpperCase() === wfparams[wfp].toUpperCase()) {
                          pfound = true;
                        }
                      }
  
                      if (!pfound) {
                        paramissue = true;
                      }
                    }
                    for (let wfp = 0; wfp < wfparams.length; wfp += 1) {
                      let pfound = false;
                      for (let p = 0; p < pronghornDotJson.methods[m].input.length; p += 1) {
                        if (pronghornDotJson.methods[m].input[p].name.toUpperCase() === wfparams[wfp].toUpperCase()) {
                          pfound = true;
                        }
                      }
  
                      if (!pfound) {
                        paramissue = true;
                      }
                    }
                  }
  
                  break;
                }
              }
  
              if (!found) {
                // this is the reason to go through both loops - log which ones are not found so
                // they can be worked
                log.error(`${pronghornDotJson.methods[m].name} not found in workflow functions`);
              }
              if (paramissue) {
                // this is the reason to go through both loops - log which ones are not found so
                // they can be worked
                log.error(`${pronghornDotJson.methods[m].name} has a parameter mismatch`);
              }
              assert.equal(true, found);
              assert.equal(false, paramissue);
            }
            done();
          } catch (error) {
            log.error(`Adapter Exception: ${error}`);
            done(error);
          }
        }).timeout(attemptTimeout);
        it('pronghorn.json should expose all workflow functions', (done) => {
          try {
            const pronghornDotJson = require('../../pronghorn.json');
            for (let w = 0; w < wffunctions.length; w += 1) {
              let found = false;
  
              for (let m = 0; m < pronghornDotJson.methods.length; m += 1) {
                if (pronghornDotJson.methods[m].name === wffunctions[w]) {
                  found = true;
                  break;
                }
              }
  
              if (!found) {
                // this is the reason to go through both loops - log which ones are not found so
                // they can be worked
                log.error(`${wffunctions[w]} not found in pronghorn.json`);
              }
              assert.equal(true, found);
            }
            done();
          } catch (error) {
            log.error(`Adapter Exception: ${error}`);
            done(error);
          }
        });
      });
  
      describe('propertiesSchema.json', () => {
        it('should have a propertiesSchema.json', (done) => {
          try {
            fs.exists('propertiesSchema.json', (val) => {
              assert.equal(true, val);
              done();
            });
          } catch (error) {
            log.error(`Test Failure: ${error}`);
            done(error);
          }
        });
        it('propertiesSchema.json should be customized', (done) => {
          try {
            const propertiesDotJson = require('../../propertiesSchema.json');
            assert.equal('adapter-Chik-Fill-A-1000I', propertiesDotJson.$id);
            done();
          } catch (error) {
            log.error(`Test Failure: ${error}`);
            done(error);
          }
        });
      });
  
      describe('error.json', () => {
        it('should have an error.json', (done) => {
          try {
            fs.exists('error.json', (val) => {
              assert.equal(true, val);
              done();
            });
          } catch (error) {
            log.error(`Test Failure: ${error}`);
            done(error);
          }
        });
      });
  
      describe('sampleProperties.json', () => {
        it('should have a sampleProperties.json', (done) => {
          try {
            fs.exists('sampleProperties.json', (val) => {
              assert.equal(true, val);
              done();
            });
          } catch (error) {
            log.error(`Test Failure: ${error}`);
            done(error);
          }
        });
      });
  
      describe('#checkProperties', () => {
        it('should have a checkProperties function', (done) => {
          try {
            assert.equal(true, typeof a.checkProperties === 'function');
            done();
          } catch (error) {
            log.error(`Test Failure: ${error}`);
            done(error);
          }
        });
        it('the sample properties should be good - if failure change the log level', (done) => {
          try {
            const samplePropsJson = require('../../sampleProperties.json');
            const clean = a.checkProperties(samplePropsJson.properties);
  
            try {
              assert.notEqual(0, Object.keys(clean));
              assert.equal(undefined, clean.exception);
              assert.notEqual(undefined, clean.host);
              assert.notEqual(null, clean.host);
              assert.notEqual('', clean.host);
              done();
            } catch (err) {
              log.error(`Test Failure: ${err}`);
              done(err);
            }
          } catch (error) {
            log.error(`Adapter Exception: ${error}`);
            done(error);
          }
        }).timeout(attemptTimeout);
      });
  
      describe('README.md', () => {
        it('should have a README', (done) => {
          try {
            fs.exists('README.md', (val) => {
              assert.equal(true, val);
              done();
            });
          } catch (error) {
            log.error(`Test Failure: ${error}`);
            done(error);
          }
        });
        it('README.md should be customized', (done) => {
          try {
            fs.readFile('README.md', 'utf8', (err, data) => {
              assert.equal(-1, data.indexOf('[System]'));
              assert.equal(-1, data.indexOf('[system]'));
              assert.equal(-1, data.indexOf('[version]'));
              assert.equal(-1, data.indexOf('[namespace]'));
              done();
            });
          } catch (error) {
            log.error(`Test Failure: ${error}`);
            done(error);
          }
        });
      });
  
      describe('#connect', () => {
        it('should have a connect function', (done) => {
          try {
            assert.equal(true, typeof a.connect === 'function');
            done();
          } catch (error) {
            log.error(`Test Failure: ${error}`);
            done(error);
          }
        });
      });
  
      describe('#healthCheck', () => {
        it('should have a healthCheck function', (done) => {
          try {
            assert.equal(true, typeof a.healthCheck === 'function');
            done();
          } catch (error) {
            log.error(`Test Failure: ${error}`);
            done(error);
          }
        });
      });
  
      describe('#checkActionFiles', () => {
        it('should have a checkActionFiles function', (done) => {
          try {
            assert.equal(true, typeof a.checkActionFiles === 'function');
            done();
          } catch (error) {
            log.error(`Test Failure: ${error}`);
            done(error);
          }
        });
        it('the action files should be good - if failure change the log level as most issues are warnings', (done) => {
          try {
            const clean = a.checkActionFiles();
  
            try {
              for (let c = 0; c < clean.length; c += 1) {
                log.error(clean[c]);
              }
              assert.equal(0, clean.length);
              done();
            } catch (err) {
              log.error(`Test Failure: ${err}`);
              done(err);
            }
          } catch (error) {
            log.error(`Adapter Exception: ${error}`);
            done(error);
          }
        }).timeout(attemptTimeout);
      });
  
      describe('#encryptProperty', () => {
        it('should have a encryptProperty function', (done) => {
          try {
            assert.equal(true, typeof a.encryptProperty === 'function');
            done();
          } catch (error) {
            log.error(`Test Failure: ${error}`);
            done(error);
          }
        });
        it('should get base64 encoded property', (done) => {
          try {
            a.encryptProperty('testing', 'base64', (data, error) => {
              try {
                assert.equal(undefined, error);
                assert.notEqual(undefined, data);
                assert.notEqual(null, data);
                assert.notEqual(undefined, data.response);
                assert.notEqual(null, data.response);
                assert.equal(0, data.response.indexOf('{code}'));
                done();
              } catch (err) {
                log.error(`Test Failure: ${err}`);
                done(err);
              }
            });
          } catch (error) {
            log.error(`Adapter Exception: ${error}`);
            done(error);
          }
        }).timeout(attemptTimeout);
        it('should get encrypted property', (done) => {
          try {
            a.encryptProperty('testing', 'encrypt', (data, error) => {
              try {
                assert.equal(undefined, error);
                assert.notEqual(undefined, data);
                assert.notEqual(null, data);
                assert.notEqual(undefined, data.response);
                assert.notEqual(null, data.response);
                assert.equal(0, data.response.indexOf('{crypt}'));
                done();
              } catch (err) {
                log.error(`Test Failure: ${err}`);
                done(err);
              }
            });
          } catch (error) {
            log.error(`Adapter Exception: ${error}`);
            done(error);
          }
        }).timeout(attemptTimeout);
      });
  
      // describe('#hasEntity', () => {
      //   it('should have a hasEntity function', (done) => {
      //     try {
      //       assert.equal(true, typeof a.hasEntity === 'function');
      //       done();
      //     } catch (error) {
      //       log.error(`Test Failure: ${error}`);
      //       done(error);
      //     }
      //   });
      //   it('should find entity', (done) => {
      //     try {
      //       a.hasEntity('template_entity', // 'a9e9c33dc61122760072455df62663d2', (data) => {
      //         try {
      //           assert.equal(true, data[0]);
      //           done();
      //         } catch (err) {
      //           log.error(`Test Failure: ${err}`);
      //           done(err);
      //         }
      //       });
      //     } catch (error) {
      //       log.error(`Adapter Exception: ${error}`);
      //       done(error);
      //     }
      //   }).timeout(attemptTimeout);
      //   it('should not find entity', (done) => {
      //     try {
      //       a.hasEntity('template_entity', 'blah', (data) => {
      //         try {
      //           assert.equal(false, data[0]);
      //           done();
      //         } catch (err) {
      //           log.error(`Test Failure: ${err}`);
      //           done(err);
      //         }
      //       });
      //     } catch (error) {
      //       log.error(`Adapter Exception: ${error}`);
      //       done(error);
      //     }
      //   }).timeout(attemptTimeout);
      // });
  
      /*
      -----------------------------------------------------------------------
      -----------------------------------------------------------------------
      *** All code above this comment will be replaced during a migration ***
      ******************* DO NOT REMOVE THIS COMMENT BLOCK ******************
      -----------------------------------------------------------------------
      -----------------------------------------------------------------------
      */
  
      describe('#iGetActiveAlerts - errors', () => {
        it('should have a iGetActiveAlerts function', (done) => {
          try {
            assert.equal(true, typeof a.iGetActiveAlerts === 'function');
            done();
          } catch (error) {
            log.error(`Test Failure: ${error}`);
            done(error);
          }
        }).timeout(attemptTimeout);
      });
  
      describe('#iGetAlertsForAPeriod - errors', () => {
        it('should have a iGetAlertsForAPeriod function', (done) => {
          try {
            assert.equal(true, typeof a.iGetAlertsForAPeriod === 'function');
            done();
          } catch (error) {
            log.error(`Test Failure: ${error}`);
            done(error);
          }
        }).timeout(attemptTimeout);
        it('should error if - missing from', (done) => {
          try {
            a.iGetAlertsForAPeriod(null, null, (data, error) => {
              try {
                const displayE = 'from is required';
                runErrorAsserts(data, error, 'AD.300', 'Test-Chik-Fill-A-1000I-adapter-iGetAlertsForAPeriod', displayE);
                done();
              } catch (err) {
                log.error(`Test Failure: ${err}`);
                done(err);
              }
            });
          } catch (error) {
            log.error(`Adapter Exception: ${error}`);
            done(error);
          }
        }).timeout(attemptTimeout);
        it('should error if - missing to', (done) => {
          try {
            a.iGetAlertsForAPeriod('fakeparam', null, (data, error) => {
              try {
                const displayE = 'to is required';
                runErrorAsserts(data, error, 'AD.300', 'Test-Chik-Fill-A-1000I-adapter-iGetAlertsForAPeriod', displayE);
                done();
              } catch (err) {
                log.error(`Test Failure: ${err}`);
                done(err);
              }
            });
          } catch (error) {
            log.error(`Adapter Exception: ${error}`);
            done(error);
          }
        }).timeout(attemptTimeout);
      });
  
      describe('#iGetAlertDetails - errors', () => {
        it('should have a iGetAlertDetails function', (done) => {
          try {
            assert.equal(true, typeof a.iGetAlertDetails === 'function');
            done();
          } catch (error) {
            log.error(`Test Failure: ${error}`);
            done(error);
          }
        }).timeout(attemptTimeout);
        it('should error if - missing alertID', (done) => {
          try {
            a.iGetAlertDetails(null, (data, error) => {
              try {
                const displayE = 'alertID is required';
                runErrorAsserts(data, error, 'AD.300', 'Test-Chik-Fill-A-1000I-adapter-iGetAlertDetails', displayE);
                done();
              } catch (err) {
                log.error(`Test Failure: ${err}`);
                done(err);
              }
            });
          } catch (error) {
            log.error(`Adapter Exception: ${error}`);
            done(error);
          }
        }).timeout(attemptTimeout);
      });
  
      describe('#iRunA1000EyesTest - errors', () => {
        it('should have a iRunA1000EyesTest function', (done) => {
          try {
            assert.equal(true, typeof a.iRunA1000EyesTest === 'function');
            done();
          } catch (error) {
            log.error(`Test Failure: ${error}`);
            done(error);
          }
        }).timeout(attemptTimeout);
        it('should error if - missing testID', (done) => {
          try {
            a.iRunA1000EyesTest(null, (data, error) => {
              try {
                const displayE = 'testID is required';
                runErrorAsserts(data, error, 'AD.300', 'Test-Chik-Fill-A-1000I-adapter-iRunA1000EyesTest', displayE);
                done();
              } catch (err) {
                log.error(`Test Failure: ${err}`);
                done(err);
              }
            });
          } catch (error) {
            log.error(`Adapter Exception: ${error}`);
            done(error);
          }
        }).timeout(attemptTimeout);
      });
  
      describe('#iGetAlertMetrics - errors', () => {
        it('should have a iGetAlertMetrics function', (done) => {
          try {
            assert.equal(true, typeof a.iGetAlertMetrics === 'function');
            done();
          } catch (error) {
            log.error(`Test Failure: ${error}`);
            done(error);
          }
        }).timeout(attemptTimeout);
        it('should error if - missing testID', (done) => {
          try {
            a.iGetAlertMetrics(null, (data, error) => {
              try {
                const displayE = 'testID is required';
                runErrorAsserts(data, error, 'AD.300', 'Test-Chik-Fill-A-1000I-adapter-iGetAlertMetrics', displayE);
                done();
              } catch (err) {
                log.error(`Test Failure: ${err}`);
                done(err);
              }
            });
          } catch (error) {
            log.error(`Adapter Exception: ${error}`);
            done(error);
          }
        }).timeout(attemptTimeout);
      });
  
      describe('#iGetAlertMetricsCopy - errors', () => {
        it('should have a iGetAlertMetricsCopy function', (done) => {
          try {
            assert.equal(true, typeof a.iGetAlertMetricsCopy === 'function');
            done();
          } catch (error) {
            log.error(`Test Failure: ${error}`);
            done(error);
          }
        }).timeout(attemptTimeout);
        it('should error if - missing testID', (done) => {
          try {
            a.iGetAlertMetricsCopy(null, null, null, (data, error) => {
              try {
                const displayE = 'testID is required';
                runErrorAsserts(data, error, 'AD.300', 'Test-Chik-Fill-A-1000I-adapter-iGetAlertMetricsCopy', displayE);
                done();
              } catch (err) {
                log.error(`Test Failure: ${err}`);
                done(err);
              }
            });
          } catch (error) {
            log.error(`Adapter Exception: ${error}`);
            done(error);
          }
        }).timeout(attemptTimeout);
        it('should error if - missing agentID', (done) => {
          try {
            a.iGetAlertMetricsCopy('fakeparam', null, null, (data, error) => {
              try {
                const displayE = 'agentID is required';
                runErrorAsserts(data, error, 'AD.300', 'Test-Chik-Fill-A-1000I-adapter-iGetAlertMetricsCopy', displayE);
                done();
              } catch (err) {
                log.error(`Test Failure: ${err}`);
                done(err);
              }
            });
          } catch (error) {
            log.error(`Adapter Exception: ${error}`);
            done(error);
          }
        }).timeout(attemptTimeout);
        it('should error if - missing roundID', (done) => {
          try {
            a.iGetAlertMetricsCopy('fakeparam', 'fakeparam', null, (data, error) => {
              try {
                const displayE = 'roundID is required';
                runErrorAsserts(data, error, 'AD.300', 'Test-Chik-Fill-A-1000I-adapter-iGetAlertMetricsCopy', displayE);
                done();
              } catch (err) {
                log.error(`Test Failure: ${err}`);
                done(err);
              }
            });
          } catch (error) {
            log.error(`Adapter Exception: ${error}`);
            done(error);
          }
        }).timeout(attemptTimeout);
      });
    });
  });
  