From df2cc4347ec895b8d5d005f759c4293f03b93c40 Mon Sep 17 00:00:00 2001 From: ferhat elmas Date: Thu, 21 Nov 2019 23:02:09 +0100 Subject: [PATCH] refactor(test): prefer forEach instead of map (#556) --- packages/opentelemetry-plugin-grpc/test/grpc.test.ts | 8 ++++---- packages/opentelemetry-tracing/test/Span.test.ts | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/opentelemetry-plugin-grpc/test/grpc.test.ts b/packages/opentelemetry-plugin-grpc/test/grpc.test.ts index eb88eed59b9..4c7d5cb73f7 100644 --- a/packages/opentelemetry-plugin-grpc/test/grpc.test.ts +++ b/packages/opentelemetry-plugin-grpc/test/grpc.test.ts @@ -239,7 +239,7 @@ function startServer(grpc: GrpcModule, proto: any) { getError('Server Stream Method Error', call.request.num) ); } else { - result.map(element => { + result.forEach(element => { call.write(element); }); } @@ -550,15 +550,15 @@ describe('GrpcPlugin', () => { }); }); - methodList.map(method => { + methodList.forEach(method => { describe(`Test automatic tracing for grpc remote method ${method.description}`, () => { runTest(method, tracer); }); }); - methodList.map(method => { + methodList.forEach(method => { describe(`Test error raising for grpc remote ${method.description}`, () => { - Object.keys(grpc.status).map((statusKey: string) => { + Object.keys(grpc.status).forEach((statusKey: string) => { // tslint:disable-next-line:no-any const errorCode = Number(grpc.status[statusKey as any]); if (errorCode > grpc.status.OK) { diff --git a/packages/opentelemetry-tracing/test/Span.test.ts b/packages/opentelemetry-tracing/test/Span.test.ts index 9de4129dc1c..7b0d3016789 100644 --- a/packages/opentelemetry-tracing/test/Span.test.ts +++ b/packages/opentelemetry-tracing/test/Span.test.ts @@ -149,7 +149,7 @@ describe('Span', () => { it('should set an attribute', () => { const span = new Span(tracer, name, spanContext, SpanKind.CLIENT); - ['String', 'Number', 'Boolean'].map(attType => { + ['String', 'Number', 'Boolean'].forEach(attType => { span.setAttribute('testKey' + attType, 'testValue' + attType); }); span.setAttribute('object', { foo: 'bar' });