UNPKG

@sentry/wizard

Version:

Sentry wizard helping you to configure your project

100 lines 4.85 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const vitest_1 = require("vitest"); const templates_1 = require("../../src/flutter/templates"); (0, vitest_1.describe)('Flutter code templates', () => { (0, vitest_1.describe)('pubspec', () => { (0, vitest_1.it)('generates pubspec with project and org', () => { const template = (0, templates_1.pubspecOptions)('fixture-project', 'fixture-org'); (0, vitest_1.expect)(template).toMatchInlineSnapshot(` "sentry: upload_debug_symbols: true upload_source_maps: true project: fixture-project org: fixture-org " `); }); }); (0, vitest_1.describe)('sentry.properties', () => { (0, vitest_1.it)('generates sentry.properties with token', () => { const template = (0, templates_1.sentryProperties)('fixture-token'); (0, vitest_1.expect)(template).toMatchInlineSnapshot(`"auth_token=fixture-token"`); }); }); (0, vitest_1.describe)('init', () => { (0, vitest_1.it)('generates Sentry config with all features enabled', () => { const template = (0, templates_1.initSnippet)('my-dsn', { tracing: true, profiling: true, replay: true, }, 'const MyApp()'); (0, vitest_1.expect)(template).toMatchInlineSnapshot(` "await SentryFlutter.init( (options) { options.dsn = 'my-dsn'; // Adds request headers and IP for users, for more info visit: // https://docs.sentry.io/platforms/dart/guides/flutter/data-management/data-collected/ options.sendDefaultPii = true; // Set tracesSampleRate to 1.0 to capture 100% of transactions for tracing. // We recommend adjusting this value in production. options.tracesSampleRate = 1.0; // The sampling rate for profiling is relative to tracesSampleRate // Setting to 1.0 will profile 100% of sampled transactions: options.profilesSampleRate = 1.0; // Configure Session Replay options.replay.sessionSampleRate = 0.1; options.replay.onErrorSampleRate = 1.0; }, appRunner: () => runApp(SentryWidget(child: const MyApp())), ); // TODO: Remove this line after sending the first sample event to sentry. await Sentry.captureException(StateError('This is a sample exception.'));" `); }); (0, vitest_1.it)('generates Sentry config with profiling & replay disabled', () => { const template = (0, templates_1.initSnippet)('my-dsn', { tracing: true, profiling: false, replay: false, }, 'const MyApp()'); (0, vitest_1.expect)(template).toMatchInlineSnapshot(` "await SentryFlutter.init( (options) { options.dsn = 'my-dsn'; // Adds request headers and IP for users, for more info visit: // https://docs.sentry.io/platforms/dart/guides/flutter/data-management/data-collected/ options.sendDefaultPii = true; // Set tracesSampleRate to 1.0 to capture 100% of transactions for tracing. // We recommend adjusting this value in production. options.tracesSampleRate = 1.0; }, appRunner: () => runApp(SentryWidget(child: const MyApp())), ); // TODO: Remove this line after sending the first sample event to sentry. await Sentry.captureException(StateError('This is a sample exception.'));" `); }); (0, vitest_1.it)('generates Sentry config with tracing, profiling & replay disabled', () => { const template = (0, templates_1.initSnippet)('my-dsn', { tracing: false, profiling: false, replay: false, }, 'const MyApp()'); (0, vitest_1.expect)(template).toMatchInlineSnapshot(` "await SentryFlutter.init( (options) { options.dsn = 'my-dsn'; // Adds request headers and IP for users, for more info visit: // https://docs.sentry.io/platforms/dart/guides/flutter/data-management/data-collected/ options.sendDefaultPii = true; }, appRunner: () => runApp(SentryWidget(child: const MyApp())), ); // TODO: Remove this line after sending the first sample event to sentry. await Sentry.captureException(StateError('This is a sample exception.'));" `); }); }); }); //# sourceMappingURL=templates.test.js.map