text: const { assert } = require('chai')
  const { assertSuccess, assertError } = require('@chainlink/adapter-test-helpers')
  const { execute } = require('../adapter')
  
  describe('execute', () => {
    const jobID = '1'
  
    context('successful calls @integration', () => {
      const requests = [
        {
          name: 'empty data',
          testData: { data: {} },
        },
        {
          name: 'no speed param',
          testData: {
            id: jobID,
            data: { endpoint: 'not_real' },
          },
        },
        {
          name: 'id not supplied',
          testData: {
            data: {
              endpoint: 'latest-minimum-gasprice',
              speed: 'fast',
            },
          },
        },
        {
          name: 'speed is standard',
          testData: {
            id: jobID,
            data: { speed: 'standard' },
          },
        },
      ]
  
      requests.forEach((req) => {
        it(`${req.name}`, (done) => {
          execute(req.testData, (statusCode, data) => {
            assertSuccess({ expected: 200, actual: statusCode }, data, jobID)
            assert.isAbove(Number(data.result), 0)
            assert.isAbove(Number(data.data.result), 0)
            done()
          })
        })
      })
    })
  
    context('validation error', () => {
      const requests = [
        {
          name: 'empty body',
          testData: {},
        },
      ]
  
      requests.forEach((req) => {
        it(`${req.name}`, (done) => {
          execute(req.testData, (statusCode, data) => {
            assertError({ expected: 400, actual: statusCode }, data, jobID)
            done()
          })
        })
      })
    })
  
    context('error calls @integration', () => {
      const requests = [
        {
          name: 'unknown endpoint',
          testData: {
            id: jobID,
            data: { speed: 'standard', endpoint: 'not_real' },
          },
        },
        {
          name: 'unknown speed',
          testData: {
            id: jobID,
            data: { speed: 'not_real' },
          },
        },
      ]
  
      requests.forEach((req) => {
        it(`${req.name}`, (done) => {
          execute(req.testData, (statusCode, data) => {
            assertError({ expected: 500, actual: statusCode }, data, jobID)
            done()
          })
        })
      })
    })
  })
  