Skip to content

Commit

Permalink
chore(test): Replaced t.equals with t.equal (#1711)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrickard authored Jul 10, 2023
1 parent 5fb4606 commit a0b255e
Show file tree
Hide file tree
Showing 7 changed files with 99 additions and 99 deletions.
2 changes: 1 addition & 1 deletion test/unit/errors/error-event-aggregator.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ tap.test('Error Event Aggregator', (t) => {
t.test('should set the correct default method', (t) => {
const method = errorEventAggregator.method

t.equals(method, 'error_event_data', 'default method should be error_event_data')
t.equal(method, 'error_event_data', 'default method should be error_event_data')
t.end()
})

Expand Down
40 changes: 20 additions & 20 deletions test/unit/errors/error-trace-aggregator.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ tap.test('Error Trace Aggregator', (t) => {
t.test('should set the correct default method', (t) => {
const method = errorTraceAggregator.method

t.equals(method, 'error_data', 'default method should be error_data')
t.equal(method, 'error_data', 'default method should be error_data')
t.end()
})

Expand All @@ -39,7 +39,7 @@ tap.test('Error Trace Aggregator', (t) => {
errorTraceAggregator.add(rawErrorTrace)

const firstError = errorTraceAggregator.errors[0]
t.equals(rawErrorTrace, firstError)
t.equal(rawErrorTrace, firstError)
t.end()
})

Expand All @@ -48,10 +48,10 @@ tap.test('Error Trace Aggregator', (t) => {
errorTraceAggregator.add(rawErrorTrace)

const data = errorTraceAggregator._getMergeData()
t.equals(data.length, 1, 'there should be one error')
t.equal(data.length, 1, 'there should be one error')

const firstError = data[0]
t.equals(rawErrorTrace, firstError, '_getMergeData should return the expected error trace')
t.equal(rawErrorTrace, firstError, '_getMergeData should return the expected error trace')
t.end()
})

Expand All @@ -60,10 +60,10 @@ tap.test('Error Trace Aggregator', (t) => {
errorTraceAggregator.add(rawErrorTrace)

const payload = errorTraceAggregator._toPayloadSync()
t.equals(payload.length, 2, 'sync payload should have runId and errorTraceData')
t.equal(payload.length, 2, 'sync payload should have runId and errorTraceData')

const [runId, errorTraceData] = payload
t.equals(runId, RUN_ID, 'run ID should match')
t.equal(runId, RUN_ID, 'run ID should match')

const expectedTraceData = [rawErrorTrace]
t.same(errorTraceData, expectedTraceData, 'errorTraceData should match')
Expand All @@ -75,10 +75,10 @@ tap.test('Error Trace Aggregator', (t) => {
errorTraceAggregator.add(rawErrorTrace)

errorTraceAggregator._toPayload((err, payload) => {
t.equals(payload.length, 2, 'payload should have two elements')
t.equal(payload.length, 2, 'payload should have two elements')

const [runId, errorTraceData] = payload
t.equals(runId, RUN_ID, 'run ID should match')
t.equal(runId, RUN_ID, 'run ID should match')

const expectedTraceData = [rawErrorTrace]
t.same(errorTraceData, expectedTraceData, 'errorTraceData should match')
Expand All @@ -97,12 +97,12 @@ tap.test('Error Trace Aggregator', (t) => {

errorTraceAggregator._merge(mergeData)

t.equals(errorTraceAggregator.errors.length, 3, 'aggregator should have three errors')
t.equal(errorTraceAggregator.errors.length, 3, 'aggregator should have three errors')

const [error1, error2, error3] = errorTraceAggregator.errors
t.equals(error1[1], 'name1', 'error1 should have expected name')
t.equals(error2[1], 'name2', 'error2 should have expected name')
t.equals(error3[1], 'name3', 'error3 should have expected name')
t.equal(error1[1], 'name1', 'error1 should have expected name')
t.equal(error2[1], 'name2', 'error2 should have expected name')
t.equal(error3[1], 'name3', 'error3 should have expected name')
t.end()
})

Expand All @@ -120,34 +120,34 @@ tap.test('Error Trace Aggregator', (t) => {

errorTraceAggregator._merge(mergeData)

t.equals(
t.equal(
errorTraceAggregator.errors.length,
LIMIT,
'aggregator should have received five errors'
)

const [error1, error2, error3, error4, error5] = errorTraceAggregator.errors
t.equals(error1[1], 'name1', 'error1 should have expected name')
t.equals(error2[1], 'name2', 'error2 should have expected name')
t.equals(error3[1], 'name3', 'error3 should have expected name')
t.equals(error4[1], 'name4', 'error4 should have expected name')
t.equals(error5[1], 'name5', 'error5 should have expected name')
t.equal(error1[1], 'name1', 'error1 should have expected name')
t.equal(error2[1], 'name2', 'error2 should have expected name')
t.equal(error3[1], 'name3', 'error3 should have expected name')
t.equal(error4[1], 'name4', 'error4 should have expected name')
t.equal(error5[1], 'name5', 'error5 should have expected name')
t.end()
})

t.test('clear() should clear errors', (t) => {
const rawErrorTrace = [0, 'name1', 'message', 'type', {}]
errorTraceAggregator.add(rawErrorTrace)

t.equals(
t.equal(
errorTraceAggregator.errors.length,
1,
'before clear(), there should be one error in the aggregator'
)

errorTraceAggregator.clear()

t.equals(
t.equal(
errorTraceAggregator.errors.length,
0,
'after clear(), there should be nothing in the aggregator'
Expand Down
52 changes: 26 additions & 26 deletions test/unit/errors/expected.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ tap.test('Expected Errors, when expected configuration is present', (t) => {
const json = apdexStats.toJSON()
tx.end()
// no errors in the frustrating column
t.equals(json[2], 0)
t.equal(json[2], 0)
t.end()
})
})
Expand All @@ -57,24 +57,24 @@ tap.test('Expected Errors, when expected configuration is present', (t) => {
tx.end()

const errorUnexpected = agent.errors.eventAggregator.getEvents()[0]
t.equals(
t.equal(
errorUnexpected[0]['error.message'],
'NOT expected',
'should be able to test unexpected errors'
)
t.equals(
t.equal(
errorUnexpected[0]['error.expected'],
false,
'unexpected errors should not have error.expected'
)

const errorExpected = agent.errors.eventAggregator.getEvents()[1]
t.equals(
t.equal(
errorExpected[0]['error.message'],
'expected',
'should be able to test expected errors'
)
t.equals(
t.equal(
errorExpected[0]['error.expected'],
true,
'expected errors should have error.expected'
Expand All @@ -100,7 +100,7 @@ tap.test('Expected Errors, when expected configuration is present', (t) => {
tx.end()

const errorUnexpected = agent.errors.eventAggregator.getEvents()[0]
t.equals(
t.equal(
errorUnexpected[0]['error.message'],
'NOT expected',
'should be able to test class-unexpected error'
Expand All @@ -111,12 +111,12 @@ tap.test('Expected Errors, when expected configuration is present', (t) => {
)

const errorExpected = agent.errors.eventAggregator.getEvents()[1]
t.equals(
t.equal(
errorExpected[0]['error.message'],
'expected',
'should be able to test class-expected error'
)
t.equals(
t.equal(
errorExpected[0]['error.expected'],
true,
'class-expected error should have error.expected'
Expand Down Expand Up @@ -144,15 +144,15 @@ tap.test('Expected Errors, when expected configuration is present', (t) => {
tx.end()

const errorUnexpected = agent.errors.eventAggregator.getEvents()[0]
t.equals(errorUnexpected[0]['error.class'], 'Error')
t.equal(errorUnexpected[0]['error.class'], 'Error')
t.notOk(
errorUnexpected[2]['error.expected'],
'type-unexpected errors should not have error.expected'
)

const errorExpected = agent.errors.eventAggregator.getEvents()[1]
t.equals(errorExpected[0]['error.class'], 'ReferenceError')
t.equals(
t.equal(errorExpected[0]['error.class'], 'ReferenceError')
t.equal(
errorExpected[0]['error.expected'],
true,
'type-expected errors should have error.expected'
Expand All @@ -171,7 +171,7 @@ tap.test('Expected Errors, when expected configuration is present', (t) => {
const json = apdexStats.toJSON()
tx.end()
// no errors in the frustrating column
t.equals(json[2], 0)
t.equal(json[2], 0)
t.end()
})
})
Expand All @@ -194,12 +194,12 @@ tap.test('Expected Errors, when expected configuration is present', (t) => {

const expectedErrorMetric = agent.metrics.getMetric(NAMES.ERRORS.EXPECTED)

t.equals(
t.equal(
transactionErrorMetric.callCount,
1,
'transactionErrorMetric.callCount should equal 1'
)
t.equals(expectedErrorMetric.callCount, 1, 'expectedErrorMetric.callCount should equal 1')
t.equal(expectedErrorMetric.callCount, 1, 'expectedErrorMetric.callCount should equal 1')
t.end()
})
})
Expand All @@ -224,10 +224,10 @@ tap.test('Expected Errors, when expected configuration is present', (t) => {
const webErrorMetric = agent.metrics.getMetric(NAMES.ERRORS.WEB)
const otherErrorMetric = agent.metrics.getMetric(NAMES.ERRORS.OTHER)

t.equals(transactionErrorMetric.callCount, 1, '')
t.equal(transactionErrorMetric.callCount, 1, '')

t.equals(allErrorMetric.callCount, 1, 'allErrorMetric.callCount should equal 1')
t.equals(webErrorMetric.callCount, 1, 'webErrorMetric.callCount should equal 1')
t.equal(allErrorMetric.callCount, 1, 'allErrorMetric.callCount should equal 1')
t.equal(webErrorMetric.callCount, 1, 'webErrorMetric.callCount should equal 1')
t.notOk(otherErrorMetric, 'should not create other error metrics')
t.end()
})
Expand Down Expand Up @@ -283,15 +283,15 @@ tap.test('Expected Errors, when expected configuration is present', (t) => {
const webErrorMetric = agent.metrics.getMetric(NAMES.ERRORS.WEB)
const otherErrorMetric = agent.metrics.getMetric(NAMES.ERRORS.OTHER)

t.equals(
t.equal(
transactionErrorMetric.callCount,
1,
'should increment transactionErrorMetric.callCount'
)

t.equals(allErrorMetric.callCount, 1, 'should increment allErrorMetric.callCount')
t.equal(allErrorMetric.callCount, 1, 'should increment allErrorMetric.callCount')
t.notOk(webErrorMetric, 'should not increment webErrorMetric')
t.equals(otherErrorMetric.callCount, 1, 'should increment otherErrorMetric.callCount')
t.equal(otherErrorMetric.callCount, 1, 'should increment otherErrorMetric.callCount')
t.end()
})
})
Expand All @@ -303,7 +303,7 @@ tap.test('Expected Errors, when expected configuration is present', (t) => {
const exception = new Exception({ error })
const result = errorHelper.isExpectedException(tx, exception, agent.config, urltils)

t.equals(result, true)
t.equal(result, true)
t.end()
})
})
Expand Down Expand Up @@ -331,13 +331,13 @@ tap.test('Expected Errors, when expected configuration is present', (t) => {
exception = new Exception({ error })
tx.addException(exception)

t.equals(tx.hasOnlyExpectedErrors(), true)
t.equal(tx.hasOnlyExpectedErrors(), true)

tx._setApdex(NAMES.APDEX, 1, 1)
const json = apdexStats.toJSON()
tx.end()
// no errors in the frustrating column
t.equals(json[2], 0)
t.equal(json[2], 0)
t.end()
})
})
Expand All @@ -346,13 +346,13 @@ tap.test('Expected Errors, when expected configuration is present', (t) => {
helper.runInTransaction(agent, function (tx) {
tx.statusCode = 500
const apdexStats = tx.metrics.getOrCreateApdexMetric(NAMES.APDEX)
t.equals(tx.hasOnlyExpectedErrors(), false)
t.equal(tx.hasOnlyExpectedErrors(), false)

tx._setApdex(NAMES.APDEX, 1, 1)
const json = apdexStats.toJSON()
tx.end()
// should put an error in the frustrating column
t.equals(json[2], 1)
t.equal(json[2], 1)
t.end()
})
})
Expand Down Expand Up @@ -382,7 +382,7 @@ tap.test('Expected Errors, when expected configuration is present', (t) => {
const json = apdexStats.toJSON()
tx.end()
// should have an error in the frustrating column
t.equals(json[2], 1)
t.equal(json[2], 1)
t.end()
})
})
Expand Down
Loading

0 comments on commit a0b255e

Please sign in to comment.