async function main (t, rate, fn, items) {
  const t0 = performance.now()

  await choker(rate, fn, items)

  const timePassed = performance.now() - t0

  const idealTime = items.length > rate.limit
    ? items.length / rate.limit * rate.interval
    : 0

  t.true(timePassed >= idealTime)
}
/**
 * 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 t0 = performance.now()
  await choker(rate, fn, items)
  const timePassed = performance.now() - t0
  const idealTime = items.length > rate.limit
    ? items.length / rate.limit * rate.interval
    : 0
  t.true(timePassed >= idealTime)
}
async function main ( t , rate , fn , items ) { const t0 = performance . now ( ) await choker ( rate , fn , items ) const timePassed = performance . now ( ) - t0 const idealTime = items . length > rate . limit ? items . length / rate . limit * rate . interval : 0 t . true ( timePassed >= idealTime ) }
Macro to spy calls and assert log for deviation from limit
Macro to spy calls and assert log for deviation from limit