function agentOutput(agent, output) {
  const txData = agent.transactionEventAggregator.getEvents()
  assert.equal(txData.length, output.transactions.length)
  output.transactions.forEach(({ name }) => {
    const foundTx = txData.find((tx) => tx[0].name === name)
    assert.ok(foundTx, `could not find ${name}`)
  })

  const spans = agent.spanEventAggregator.getEvents()
  output.spans.forEach((span, i) => {
    const spanFromAgent = spans.find((s) => s.intrinsics.name === span.name)
    assert.ok(spanFromAgent)
    if (span.category) {
      assert.equal(spanFromAgent.intrinsics.category, span.category)
    }

    if (span.entryPoint) {
      assert.equal(spanFromAgent.intrinsics['nr.entryPoint'], true)
    }

    if (span.attributes) {
      for (const attr in span.attributes) {
        assert.equal(spanFromAgent.attributes[attr], span.attributes[attr])
      }
    }

    if (span.parentName) {
      const parent = spans.find((s) => {
        return s.intrinsics.name.endsWith(span.parentName)
      })
      assert.equal(spanFromAgent.intrinsics.parentId, parent.intrinsics.guid)
    }
  })
}
Asserts transactions and spans collected during test run.

@param {Agent} agent instance
@param {object} output collection that asserts all transactions/spans created during test run