Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
test: final tweaks to _processErrors
  • Loading branch information
amychisholm03 committed Jul 2, 2024
commit be110d8fe6376f15c436182024c17beb97bf7b80
17 changes: 10 additions & 7 deletions test/unit/errors/error-collector.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2372,26 +2372,25 @@ test('When using the async listener', (t) => {
})

tap.test('_processErrors', (t) => {
let transaction = null
let errorCollector = null

t.beforeEach(() => {
t.beforeEach((t) => {
t.context.agent = helper.loadMockedAgent({
attributes: {
enabled: true
}
})

transaction = new Transaction(t.context.agent)
const transaction = new Transaction(t.context.agent)
transaction.url = '/'
errorCollector = t.context.agent.errors
t.context.transaction = transaction
t.context.errorCollector = t.context.agent.errors
})

t.afterEach(() => {
t.afterEach((t) => {
helper.unloadAgent(t.context.agent)
})

t.test('invalid errorType should return no iterableProperty', (t) => {
const { errorCollector, transaction } = t.context
const errorType = 'invalid'
const result = errorCollector._getIterableProperty(transaction, errorType)

Expand All @@ -2400,6 +2399,7 @@ tap.test('_processErrors', (t) => {
})

t.test('if errorType is transaction, should return no iterableProperty', (t) => {
const { errorCollector, transaction } = t.context
const errorType = 'transaction'
const result = errorCollector._getIterableProperty(transaction, errorType)

Expand All @@ -2408,6 +2408,7 @@ tap.test('_processErrors', (t) => {
})

t.test('if type is user, return an array of objects', (t) => {
const { errorCollector, transaction } = t.context
const errorType = 'user'
const result = errorCollector._getIterableProperty(transaction, errorType)

Expand All @@ -2416,6 +2417,7 @@ tap.test('_processErrors', (t) => {
})

t.test('if type is transactionException, return an array of objects', (t) => {
const { errorCollector, transaction } = t.context
const errorType = 'transactionException'
const result = errorCollector._getIterableProperty(transaction, errorType)

Expand All @@ -2426,6 +2428,7 @@ tap.test('_processErrors', (t) => {
t.test(
'if iterableProperty is null and errorType is not transaction, do not modify collectedErrors or expectedErrors',
(t) => {
const { errorCollector, transaction } = t.context
const errorType = 'error'
const collectedErrors = 0
const expectedErrors = 0
Expand Down