async function main (t, rate, fn, items) {
  const acc = []

  const log = () => acc.push(Date.now())

  const spy = item => {
    return Promise
      .resolve(item)
      .then(fn)
      .then(R.tap(log))
  }

  await choker(rate, spy, items)

  t.true(isValidBy(rate, acc))
}
/**
 * Macro to spy calls and assert log for deviation from limit
 */
Macro to spy calls and assert log for deviation from limit
Macro to spy calls and assert log for deviation from limit
async function main (t, rate, fn, items) {
  const acc = []
  const log = () => acc.push(Date.now())
  const spy = item => {
    return Promise
      .resolve(item)
      .then(fn)
      .then(R.tap(log))
  }
  await choker(rate, spy, items)
  t.true(isValidBy(rate, acc))
}
async function main ( t , rate , fn , items ) { const acc = [ ] const log = ( ) => acc . push ( Date . now ( ) ) const spy = item => { return Promise . resolve ( item ) . then ( fn ) . then ( R . tap ( log ) ) } await choker ( rate , spy , items ) t . true ( isValidBy ( rate , acc ) ) }
Macro to spy calls and assert log for deviation from limit
Macro to spy calls and assert log for deviation from limit