From bc9d82799014d0204219a2a7e0baeec338ddcf43 Mon Sep 17 00:00:00 2001 From: Kudlaty Date: Wed, 17 Feb 2021 15:44:03 +0100 Subject: [PATCH] test(exporter-collector): add test for converting number to int and double --- .../test/common/transform.test.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/packages/opentelemetry-exporter-collector/test/common/transform.test.ts b/packages/opentelemetry-exporter-collector/test/common/transform.test.ts index 3bcb5e8acec..f212a7774a4 100644 --- a/packages/opentelemetry-exporter-collector/test/common/transform.test.ts +++ b/packages/opentelemetry-exporter-collector/test/common/transform.test.ts @@ -37,12 +37,21 @@ describe('transform', () => { ]); }); - it('should convert attribute integer', () => { + it('should convert attribute integer to integer', () => { const attributes: SpanAttributes = { foo: 13, }; assert.deepStrictEqual(transform.toCollectorAttributes(attributes), [ - { key: 'foo', value: { doubleValue: 13 } }, + { key: 'foo', value: { intValue: 13 } }, + ]); + }); + + it('should convert attribute integer to double', () => { + const attributes: SpanAttributes = { + foo: 2247483647, + }; + assert.deepStrictEqual(transform.toCollectorAttributes(attributes), [ + { key: 'foo', value: { doubleValue: 2247483647 } }, ]); }); @@ -118,7 +127,7 @@ describe('transform', () => { }, { key: 'version', - value: { doubleValue: 1 }, + value: { intValue: 1 }, }, { key: 'success', value: { boolValue: true } }, ],