UNPKG

@sentry/wizard

Version:

Sentry wizard helping you to configure your project

77 lines 2.45 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const expo_1 = require("../../src/react-native/expo"); describe('expo', () => { const MOCK_CONFIG = { url: 'https://sentry.mock/', org: 'sentry-mock', project: 'project-mock', authToken: 'authToken-mock', }; describe('addWithSentryToAppConfigJson', () => { test('do not add if sentry-expo present', () => { const appConfigJson = `{ "expo": { "plugins": ["sentry-expo"] } }`; expect((0, expo_1.addWithSentryToAppConfigJson)(appConfigJson, MOCK_CONFIG)).toBeNull(); }); test('do not add if sentry-react-native/expo present', () => { const appConfigJson = `{ "expo": { "plugins": ["@sentry/react-native/expo"] } }`; expect((0, expo_1.addWithSentryToAppConfigJson)(appConfigJson, MOCK_CONFIG)).toBeNull(); }); test.each([ [ `{ "expo": { "plugins": "should be an array, but it is not" } }`, ], [ `{ "expo": ["should be an object, but it is not"] }`, ], ])('do not add if plugins is not an array', (appConfigJson) => { expect((0, expo_1.addWithSentryToAppConfigJson)(appConfigJson, MOCK_CONFIG)).toBeNull(); }); test.each([ [ `{ "expo": { "plugins": [] } }`, ], [`{}`], [ `{ "expo": {} }`, ], ])('add sentry react native expo plugin configuration', (appConfigJson) => { const result = (0, expo_1.addWithSentryToAppConfigJson)(appConfigJson, MOCK_CONFIG); expect(JSON.parse(result ?? '{}')).toStrictEqual({ expo: { plugins: [ [ '@sentry/react-native/expo', { url: 'https://sentry.mock/', organization: 'sentry-mock', project: 'project-mock', }, ], ], }, }); }); }); }); //# sourceMappingURL=expo.test.js.map