Skip to content

Commit 79fb8e9

Browse files
authored
chore: Refactored loops to be simpler (#2990)
1 parent ed17a6d commit 79fb8e9

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

test/integration/distributed-tracing/trace-context-cross-agent.test.js

+6-11
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ test('helper functions', () => {
122122

123123
test('distributed tracing trace context', async (t) => {
124124
const testCases = require('../../lib/cross_agent_tests/distributed_tracing/trace_context.json')
125-
for (const [i] of testCases.entries()) {
126-
await runTestCase(testCases[i], t)
125+
for (const testCase of testCases) {
126+
await runTestCase(testCase, t)
127127
}
128128
})
129129

@@ -190,8 +190,7 @@ const testExpectedFixtureKeys = function (thingWithKeys, expectedKeys) {
190190
if (!Array.isArray(actualKeys)) {
191191
actualKeys = Object.keys(thingWithKeys)
192192
}
193-
for (const [i] of actualKeys.entries()) {
194-
const key = actualKeys[i]
193+
for (const key of actualKeys) {
195194
assert.ok(expectedKeys.indexOf(key) !== -1, 'key [' + key + '] should be expected?')
196195
}
197196
}
@@ -282,8 +281,7 @@ async function runTestCase(testCase, parentTest) {
282281
])
283282

284283
if (testCase.outbound_payloads) {
285-
for (const [i] of testCase.outbound_payloads.entries()) {
286-
const outboundPayload = testCase.outbound_payloads[i]
284+
for (const outboundPayload of testCase.outbound_payloads) {
287285
testExpectedFixtureKeys(outboundPayload, [
288286
'exact',
289287
'expected',
@@ -311,8 +309,7 @@ async function runTestCase(testCase, parentTest) {
311309
testExpectedFixtureKeys(testCase.intrinsics.target_events, expectedEvents)
312310

313311
// test the top level keys of each event
314-
for (const [i] of testCase.intrinsics.target_events.entries()) {
315-
const event = testCase.intrinsics.target_events[i]
312+
for (const event of testCase.intrinsics.target_events) {
316313
const eventTestConfig = testCase.intrinsics[event]
317314

318315
// a few tests list an expected event, but no data for that event
@@ -363,9 +360,7 @@ async function runTestCase(testCase, parentTest) {
363360
}
364361
}
365362

366-
for (const [key] of testCase.inbound_headers.entries()) {
367-
const inboundHeader = testCase.inbound_headers[key]
368-
363+
for (const inboundHeader of testCase.inbound_headers.values()) {
369364
transaction.acceptDistributedTraceHeaders(testCase.transport_type, inboundHeader)
370365

371366
// Generate outbound payloads

0 commit comments

Comments
 (0)