From 1124ad8626a458632aa351d489b638b8eacc08ed Mon Sep 17 00:00:00 2001 From: Onur Temizkan Date: Fri, 25 Mar 2022 18:05:05 +0000 Subject: [PATCH] test(node): Add `setTag` integration tests. --- .../setTag/with-primitives/scenario.ts | 15 +++++++++++++++ .../public-api/setTag/with-primitives/test.ts | 17 +++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 packages/node-integration-tests/suites/public-api/setTag/with-primitives/scenario.ts create mode 100644 packages/node-integration-tests/suites/public-api/setTag/with-primitives/test.ts diff --git a/packages/node-integration-tests/suites/public-api/setTag/with-primitives/scenario.ts b/packages/node-integration-tests/suites/public-api/setTag/with-primitives/scenario.ts new file mode 100644 index 000000000000..50b094b84bb2 --- /dev/null +++ b/packages/node-integration-tests/suites/public-api/setTag/with-primitives/scenario.ts @@ -0,0 +1,15 @@ +import * as Sentry from '@sentry/node'; + +Sentry.init({ + dsn: 'https://public@dsn.ingest.sentry.io/1337', + release: '1.0', +}); + +Sentry.setTag('tag_1', 'foo'); +Sentry.setTag('tag_2', Math.PI); +Sentry.setTag('tag_3', false); +Sentry.setTag('tag_4', null); +Sentry.setTag('tag_5', undefined); +Sentry.setTag('tag_6', -1); + +Sentry.captureMessage('primitive_tags'); diff --git a/packages/node-integration-tests/suites/public-api/setTag/with-primitives/test.ts b/packages/node-integration-tests/suites/public-api/setTag/with-primitives/test.ts new file mode 100644 index 000000000000..c6b94aca64d1 --- /dev/null +++ b/packages/node-integration-tests/suites/public-api/setTag/with-primitives/test.ts @@ -0,0 +1,17 @@ +import { assertSentryEvent, getEventRequest, runServer } from '../../../../utils'; + +test('should set primitive tags', async () => { + const url = await runServer(__dirname); + const requestBody = await getEventRequest(url); + + assertSentryEvent(requestBody, { + message: 'primitive_tags', + tags: { + tag_1: 'foo', + tag_2: 3.141592653589793, + tag_3: false, + tag_4: null, + tag_6: -1, + }, + }); +});