UNPKG

@sentry/wizard

Version:

Sentry wizard helping you to configure your project

126 lines (123 loc) 4.67 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const vitest_1 = require("vitest"); const angular_wizard_1 = require("../../src/angular/angular-wizard"); const main_1 = require("../../src/angular/codemods/main"); vitest_1.vi.mock('../../src/utils/clack/mcp-config', () => ({ offerProjectScopedMcpConfig: vitest_1.vi.fn().mockResolvedValue(undefined), })); (0, vitest_1.describe)('angular-wizard', () => { (0, vitest_1.describe)('buildOutroMessage', () => { (0, vitest_1.it)('returns the correct outro message if example component was created', () => { (0, vitest_1.expect)((0, angular_wizard_1.buildOutroMessage)(true)).toMatchInlineSnapshot(` " Successfully installed the Sentry Angular SDK! You can validate your setup by starting your dev environment (ng serve) and throwing an error in the example component. Check out the SDK documentation for further configuration: https://docs.sentry.io/platforms/javascript/guides/angular/" `); }); (0, vitest_1.it)('returns the correct outro message if example component creation was skipped', () => { (0, vitest_1.expect)((0, angular_wizard_1.buildOutroMessage)(false)).toMatchInlineSnapshot(` " Successfully installed the Sentry Angular SDK! Check out the SDK documentation for further configuration: https://docs.sentry.io/platforms/javascript/guides/angular/" `); }); }); (0, vitest_1.describe)('getInitCallArgs', () => { (0, vitest_1.it)('returns the correct init call arguments when all features are enabled', () => { const args = (0, main_1.getInitCallArgs)('https://example.com', { performance: true, replay: true, logs: true, }); (0, vitest_1.expect)(args).toMatchInlineSnapshot(` { "dsn": "https://example.com", "enableLogs": true, "integrations": [ {}, {}, ], "replaysOnErrorSampleRate": 1, "replaysSessionSampleRate": 0.1, "sendDefaultPii": true, "tracesSampleRate": 1, } `); }); (0, vitest_1.it)('returns the correct init call arguments when performance is disabled', () => { const args = (0, main_1.getInitCallArgs)('https://example.com', { performance: false, replay: true, logs: true, }); (0, vitest_1.expect)(args).toMatchInlineSnapshot(` { "dsn": "https://example.com", "enableLogs": true, "integrations": [ {}, ], "replaysOnErrorSampleRate": 1, "replaysSessionSampleRate": 0.1, "sendDefaultPii": true, } `); }); (0, vitest_1.it)('returns the correct init call arguments when replay is disabled', () => { const args = (0, main_1.getInitCallArgs)('https://example.com', { performance: true, replay: false, logs: true, }); (0, vitest_1.expect)(args).toMatchInlineSnapshot(` { "dsn": "https://example.com", "enableLogs": true, "integrations": [ {}, ], "sendDefaultPii": true, "tracesSampleRate": 1, } `); }); (0, vitest_1.it)('returns the correct init call arguments when logs are disabled', () => { const args = (0, main_1.getInitCallArgs)('https://example.com', { performance: true, replay: true, logs: false, }); (0, vitest_1.expect)(args).toMatchInlineSnapshot(` { "dsn": "https://example.com", "integrations": [ {}, {}, ], "replaysOnErrorSampleRate": 1, "replaysSessionSampleRate": 0.1, "sendDefaultPii": true, "tracesSampleRate": 1, } `); }); (0, vitest_1.it)('returns the correct init call arguments when all features are disabled', () => { const args = (0, main_1.getInitCallArgs)('https://example.com', { performance: false, replay: false, logs: false, }); (0, vitest_1.expect)(args).toMatchInlineSnapshot(` { "dsn": "https://example.com", "sendDefaultPii": true, } `); }); }); }); //# sourceMappingURL=angular-wizard.test.js.map