// Import AVA
import test from 'ava'

// Imports
import sleep from '../../../src/util/sleep'
import Client from '../../../src/client/etherscan'

// Test data
const testAddress = '0xde0b295669a9fd93d5f28d9ec85e40f4cb697bae'

// Sleep before each test
test.beforeEach('rate limit', async t => {
  console.log()
  console.log('-- Rate limiting')
  console.log()
  await sleep(1000)
})

/**
 * Valid address.
 */
test.serial('valid address', async t => {
  console.log('Acquire with valid address')
  const client = new Client()
  const prom = client
    .listAccountTransactions(testAddress)
  await t.notThrows(prom)
  const txs = await prom
  const numTxs = txs.length
  console.log('Found ' + numTxs + ' txs')
})

/**
 * Bad address.
 */
test.serial('bad address', async t => {
  console.log('Acquire with bad address')
  const client = new Client()
  const prom = client
    .listAccountTransactions('test')
  await t.throws(prom)
})

@@ -215,16 +215,89 @@
 b697bae'
+%0Aconst testUnusedAddress%0A  = '0xe148E5AA46401b7bEe89D1F6103776ba508024e0'
 %0A%0A// Sle
@@ -776,24 +776,405 @@
 ' txs')%0A%7D)%0A%0A
+/**%0A * Valid unused address.%0A */%0Atest.serial('valid unused address', async t =%3E %7B%0A  console.log('Acquire with valid unused address')%0A  const client = new Client()%0A  const prom = client%0A    .listAccountTransactions(testUnusedAddress)%0A  await t.notThrows(prom)%0A  const txs = await prom%0A  const numTxs = txs.length%0A  console.log('Found ' + numTxs + ' txs')%0A  t.true(numTxs === 0)%0A%7D)%0A%0A
 /**%0A * Bad a

Add Etherscan list txs unused address test